aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorHabeas Codice <habeascodice@federated.social>2014-11-18 12:14:14 -0800
committerHabeas Codice <habeascodice@federated.social>2014-11-18 12:14:14 -0800
commit6413395a76d57960708f17016f04a682b3643aa7 (patch)
tree32ba1c7156f4e7c4bc72dcea384bfedf2d35834c /mod
parent6cc906fd1d7226e4db2f546551c14fe04ea815e7 (diff)
parent1d96e165e00ed54df0573bda79c2a274f21aeb16 (diff)
downloadvolse-hubzilla-6413395a76d57960708f17016f04a682b3643aa7.tar.gz
volse-hubzilla-6413395a76d57960708f17016f04a682b3643aa7.tar.bz2
volse-hubzilla-6413395a76d57960708f17016f04a682b3643aa7.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'mod')
-rw-r--r--mod/channel.php41
-rw-r--r--mod/network.php38
-rw-r--r--mod/ping.php28
-rw-r--r--mod/settings.php11
4 files changed, 92 insertions, 26 deletions
diff --git a/mod/channel.php b/mod/channel.php
index 1cc2dc02c..54b25ad8b 100644
--- a/mod/channel.php
+++ b/mod/channel.php
@@ -137,6 +137,11 @@ function channel_content(&$a, $update = 0, $load = false) {
$sql_extra = item_permissions_sql($a->profile['profile_uid'],$remote_contact,$groups);
+ if(get_pconfig($a->profile['profile_uid'],'system','channel_list_mode'))
+ $page_mode = 'list';
+ else
+ $page_mode = 'client';
+
if(($update) && (! $load)) {
if ($mid) {
@@ -246,9 +251,14 @@ function channel_content(&$a, $update = 0, $load = false) {
// This is ugly, but we can't pass the profile_uid through the session to the ajax updater,
// because browser prefetching might change it on us. We have to deliver it with the page.
+ $maxheight = get_pconfig($a->profile['profile_uid'],'system','channel_divmore_height');
+ if(! $maxheight)
+ $maxheight = 400;
+
$o .= '<div id="live-channel"></div>' . "\r\n";
$o .= "<script> var profile_uid = " . $a->profile['profile_uid']
- . "; var netargs = '?f='; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
+ . "; var netargs = '?f='; var profile_page = " . $a->pager['page']
+ . "; divmore_height = " . intval($maxheight) . "; </script>\r\n";
$a->page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array(
'$baseurl' => z_root(),
@@ -279,12 +289,31 @@ function channel_content(&$a, $update = 0, $load = false) {
}
+ $update_unseen = '';
+
+ if($page_mode === 'list') {
+ /**
+ * in "list mode", only mark the parent item and any like activities as "seen".
+ * We won't distinguish between comment likes and post likes. The important thing
+ * is that the number of unseen comments will be accurate. The SQL to separate the
+ * comment likes could also get somewhat hairy.
+ */
- if($is_owner) {
+ if($parents_str) {
+ $update_unseen = " AND ( id IN ( " . dbesc($parents_str) . " )";
+ $update_unseen .= " OR ( parent IN ( " . dbesc($parents_str) . " ) AND verb in ( '" . dbesc(ACTIVITY_LIKE) . "','" . dbesc(ACTIVITY_DISLIKE) . "' ))) ";
+ }
+ }
+ else {
+ if($parents_str) {
+ $update_unseen = " AND parent IN ( " . dbesc($parents_str) . " )";
+ }
+ }
+ if($is_owner && $update_unseen) {
$r = q("UPDATE item SET item_flags = (item_flags & ~%d)
- WHERE (item_flags & %d)>0 AND (item_flags & %d)>0 AND uid = %d ",
+ WHERE (item_flags & %d) > 0 AND (item_flags & %d) > 0 AND uid = %d $update_unseen",
intval(ITEM_UNSEEN),
intval(ITEM_UNSEEN),
intval(ITEM_WALL),
@@ -293,12 +322,6 @@ function channel_content(&$a, $update = 0, $load = false) {
}
- if(get_pconfig($a->profile['profile_uid'],'system','channel_list_mode'))
- $page_mode = 'list';
- else
- $page_mode = 'client';
-
-
if($_COOKIE['jsAvailable'] == 1) {
$o .= conversation($a,$items,'channel',$update,$page_mode);
} else {
diff --git a/mod/network.php b/mod/network.php
index d6c19eca7..522622f03 100644
--- a/mod/network.php
+++ b/mod/network.php
@@ -208,8 +208,15 @@ function network_content(&$a, $update = 0, $load = false) {
if($gid || $cid || $cmin || ($cmax != 99) || $star || $liked || $conv || $spam || $nouveau || $list)
$firehose = 0;
+ $maxheight = get_pconfig(local_user(),'system','network_divmore_height');
+ if(! $maxheight)
+ $maxheight = 400;
+
+
$o .= '<div id="live-network"></div>' . "\r\n";
- $o .= "<script> var profile_uid = " . local_user() . "; var profile_page = " . $a->pager['page'] . ";</script>";
+ $o .= "<script> var profile_uid = " . local_user()
+ . "; var profile_page = " . $a->pager['page']
+ . "; divmore_height = " . intval($maxheight) . "; </script>\r\n";
$a->page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array(
'$baseurl' => z_root(),
@@ -317,6 +324,11 @@ function network_content(&$a, $update = 0, $load = false) {
$uids = " and item.uid = " . local_user() . " ";
}
+ if(get_pconfig(local_user(),'system','network_list_mode'))
+ $page_mode = 'list';
+ else
+ $page_mode = 'client';
+
$simple_update = (($update) ? " and ( item.item_flags & " . intval(ITEM_UNSEEN) . " ) > 0 " : '');
// This fixes a very subtle bug so I'd better explain it. You wake up in the morning or return after a day
@@ -414,9 +426,25 @@ function network_content(&$a, $update = 0, $load = false) {
$items = array();
}
- if($parents_str)
- $update_unseen = ' AND parent IN ( ' . dbesc($parents_str) . ' )';
+ if($page_mode === 'list') {
+ /**
+ * in "list mode", only mark the parent item and any like activities as "seen".
+ * We won't distinguish between comment likes and post likes. The important thing
+ * is that the number of unseen comments will be accurate. The SQL to separate the
+ * comment likes could also get somewhat hairy.
+ */
+
+ if($parents_str) {
+ $update_unseen = " AND ( id IN ( " . dbesc($parents_str) . " )";
+ $update_unseen .= " OR ( parent IN ( " . dbesc($parents_str) . " ) AND verb in ( '" . dbesc(ACTIVITY_LIKE) . "','" . dbesc(ACTIVITY_DISLIKE) . "' ))) ";
+ }
+ }
+ else {
+ if($parents_str) {
+ $update_unseen = " AND parent IN ( " . dbesc($parents_str) . " )";
+ }
+ }
}
if(($update_unseen) && (! $firehose))
@@ -429,10 +457,6 @@ function network_content(&$a, $update = 0, $load = false) {
$mode = (($nouveau) ? 'network-new' : 'network');
- if(get_pconfig(local_user(),'system','network_list_mode'))
- $page_mode = 'list';
- else
- $page_mode = 'client';
$o .= conversation($a,$items,$mode,$update,$page_mode);
diff --git a/mod/ping.php b/mod/ping.php
index d7b9e3d2e..ef8afd91c 100644
--- a/mod/ping.php
+++ b/mod/ping.php
@@ -150,14 +150,14 @@ function ping_init(&$a) {
if(x($_REQUEST, 'markRead') && local_user()) {
switch($_REQUEST['markRead']) {
case 'network':
- $r = q("update item set item_flags = ( item_flags & ~%d ) where (item_flags & %d)>0 and uid = %d",
+ $r = q("update item set item_flags = ( item_flags & ~%d ) where (item_flags & %d) > 0 and uid = %d",
intval(ITEM_UNSEEN),
intval(ITEM_UNSEEN),
intval(local_user())
);
break;
case 'home':
- $r = q("update item set item_flags = ( item_flags & ~%d ) where (item_flags & %d)>0 and (item_flags & %d) and uid = %d",
+ $r = q("update item set item_flags = ( item_flags & ~%d ) where (item_flags & %d) > 0 and (item_flags & %d) > 0 and uid = %d",
intval(ITEM_UNSEEN),
intval(ITEM_UNSEEN),
intval(ITEM_WALL),
@@ -165,7 +165,7 @@ function ping_init(&$a) {
);
break;
case 'messages':
- $r = q("update mail set mail_flags = ( mail_flags | %d ) where channel_id = %d and not (mail_flags & %d)>0",
+ $r = q("update mail set mail_flags = ( mail_flags | %d ) where channel_id = %d and not (mail_flags & %d) > 0",
intval(MAIL_SEEN),
intval(local_user()),
intval(MAIL_SEEN)
@@ -186,6 +186,14 @@ function ping_init(&$a) {
}
}
+ if(x($_REQUEST, 'markItemRead') && local_user()) {
+ $r = q("update item set item_flags = ( item_flags & ~%d ) where parent = %d and uid = %d",
+ intval(ITEM_UNSEEN),
+ intval($_REQUEST['markItemRead']),
+ intval(local_user())
+ );
+ }
+
/**
@@ -237,7 +245,7 @@ function ping_init(&$a) {
if(argc() > 1 && argv(1) === 'messages') {
$channel = $a->get_channel();
$t = q("select mail.*, xchan.* from mail left join xchan on xchan_hash = from_xchan
- where channel_id = %d and not ( mail_flags & %d )>0 and not (mail_flags & %d )>0
+ where channel_id = %d and not ( mail_flags & %d ) > 0 and not (mail_flags & %d ) > 0
and from_xchan != '%s' order by created desc limit 50",
intval(local_user()),
intval(MAIL_SEEN),
@@ -267,7 +275,7 @@ function ping_init(&$a) {
$result = array();
$r = q("SELECT * FROM item
- WHERE item_restrict = %d and ( item_flags & %d )>0 and uid = %d",
+ WHERE item_restrict = %d and ( item_flags & %d ) > 0 and uid = %d",
intval(ITEM_VISIBLE),
intval(ITEM_UNSEEN),
intval(local_user())
@@ -289,7 +297,7 @@ function ping_init(&$a) {
if(argc() > 1 && (argv(1) === 'intros')) {
$result = array();
- $r = q("SELECT * FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash where abook_channel = %d and (abook_flags & %d)>0 and not ((abook_flags & %d)>0 or (xchan_flags & %d)>0)",
+ $r = q("SELECT * FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash where abook_channel = %d and (abook_flags & %d) > 0 and not ((abook_flags & %d) > 0 or (xchan_flags & %d) > 0)",
intval(local_user()),
intval(ABOOK_FLAG_PENDING),
intval(ABOOK_FLAG_SELF|ABOOK_FLAG_IGNORED),
@@ -373,7 +381,7 @@ function ping_init(&$a) {
if($vnotify & (VNOTIFY_NETWORK|VNOTIFY_CHANNEL)) {
$r = q("SELECT id, item_restrict, item_flags FROM item
- WHERE (item_restrict = %d) and ( item_flags & %d )>0 and uid = %d",
+ WHERE (item_restrict = %d) and ( item_flags & %d ) > 0 and uid = %d",
intval(ITEM_VISIBLE),
intval(ITEM_UNSEEN),
intval(local_user())
@@ -400,7 +408,7 @@ function ping_init(&$a) {
$t2 = dba_timer();
if($vnotify & VNOTIFY_INTRO) {
- $intr = q("SELECT COUNT(abook.abook_id) AS total FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash where abook_channel = %d and (abook_flags & %d)>0 and not ((abook_flags & %d)>0 or (xchan_flags & %d)>0)",
+ $intr = q("SELECT COUNT(abook.abook_id) AS total FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash where abook_channel = %d and (abook_flags & %d) > 0 and not ((abook_flags & %d) > 0 or (xchan_flags & %d) > 0)",
intval(local_user()),
intval(ABOOK_FLAG_PENDING),
intval(ABOOK_FLAG_SELF|ABOOK_FLAG_IGNORED),
@@ -418,7 +426,7 @@ function ping_init(&$a) {
if($vnotify & VNOTIFY_MAIL) {
$mails = q("SELECT count(id) as total from mail
- WHERE channel_id = %d AND not (mail_flags & %d)>0 and from_xchan != '%s' ",
+ WHERE channel_id = %d AND not (mail_flags & %d) > 0 and from_xchan != '%s' ",
intval(local_user()),
intval(MAIL_SEEN),
dbesc($channel['channel_hash'])
@@ -429,7 +437,7 @@ function ping_init(&$a) {
if($vnotify & VNOTIFY_REGISTER) {
if ($a->config['system']['register_policy'] == REGISTER_APPROVE && is_site_admin()) {
- $regs = q("SELECT count(account_id) as total from account where (account_flags & %d)>0",
+ $regs = q("SELECT count(account_id) as total from account where (account_flags & %d) > 0",
intval(ACCOUNT_PENDING)
);
if($regs)
diff --git a/mod/settings.php b/mod/settings.php
index 725825b34..ab6638ccb 100644
--- a/mod/settings.php
+++ b/mod/settings.php
@@ -143,6 +143,12 @@ function settings_post(&$a) {
$channel_list_mode = ((x($_POST,'channel_list_mode')) ? intval($_POST['channel_list_mode']) : 0);
$network_list_mode = ((x($_POST,'network_list_mode')) ? intval($_POST['network_list_mode']) : 0);
+ $channel_divmore_height = ((x($_POST,'channel_divmore_height')) ? intval($_POST['channel_divmore_height']) : 400);
+ if($channel_divmore_height < 50)
+ $channel_divmore_height = 50;
+ $network_divmore_height = ((x($_POST,'network_divmore_height')) ? intval($_POST['network_divmore_height']) : 400);
+ if($network_divmore_height < 50)
+ $network_divmore_height = 50;
$browser_update = ((x($_POST,'browser_update')) ? intval($_POST['browser_update']) : 0);
$browser_update = $browser_update * 1000;
@@ -165,6 +171,8 @@ function settings_post(&$a) {
set_pconfig(local_user(),'system','title_tosource',$title_tosource);
set_pconfig(local_user(),'system','channel_list_mode', $channel_list_mode);
set_pconfig(local_user(),'system','network_list_mode', $network_list_mode);
+ set_pconfig(local_user(),'system','channel_divmore_height', $channel_divmore_height);
+ set_pconfig(local_user(),'system','network_divmore_height', $network_divmore_height);
if ($theme == $a->channel['channel_theme']){
// call theme_post only if theme has not been changed
@@ -810,6 +818,9 @@ function settings_content(&$a) {
'$expert' => feature_enabled(local_user(),'expert'),
'$channel_list_mode' => array('channel_list_mode', t('Use blog/list mode on channel page'), get_pconfig(local_user(),'system','channel_list_mode'), t('(comments displayed separately)')),
'$network_list_mode' => array('network_list_mode', t('Use blog/list mode on matrix page'), get_pconfig(local_user(),'system','network_list_mode'), t('(comments displayed separately)')),
+ '$channel_divmore_height' => array('channel_divmore_height', t('Channel page max height of content (in pixels)'), ((get_pconfig(local_user(),'system','channel_divmore_height')) ? get_pconfig(local_user(),'system','channel_divmore_height') : 400), t('click to expand content exceeding this height')),
+ '$network_divmore_height' => array('network_divmore_height', t('Matrix page max height of content (in pixels)'), ((get_pconfig(local_user(),'system','network_divmore_height')) ? get_pconfig(local_user(),'system','network_divmore_height') : 400) , t('click to expand content exceeding this height')),
+
));