aboutsummaryrefslogtreecommitdiffstats
path: root/mod/channel.php
diff options
context:
space:
mode:
Diffstat (limited to 'mod/channel.php')
-rw-r--r--mod/channel.php41
1 files changed, 32 insertions, 9 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 {