aboutsummaryrefslogtreecommitdiffstats
path: root/mod/channel.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-11-17 15:43:03 -0800
committerfriendica <info@friendica.com>2014-11-17 15:43:03 -0800
commit65a6121014b1b985d176ea482077400cfee1c3a9 (patch)
tree0c9ff87969bbdc5f6a8cc9ea024970c861e6c305 /mod/channel.php
parent064b48fa712acf00162a65638b134883c8b1afa0 (diff)
downloadvolse-hubzilla-65a6121014b1b985d176ea482077400cfee1c3a9.tar.gz
volse-hubzilla-65a6121014b1b985d176ea482077400cfee1c3a9.tar.bz2
volse-hubzilla-65a6121014b1b985d176ea482077400cfee1c3a9.zip
fix the update_unseen stuff on the channel page also
Diffstat (limited to 'mod/channel.php')
-rw-r--r--mod/channel.php34
1 files changed, 26 insertions, 8 deletions
diff --git a/mod/channel.php b/mod/channel.php
index 1cc2dc02c..b91b6bcef 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) {
@@ -279,12 +284,31 @@ function channel_content(&$a, $update = 0, $load = false) {
}
+ $update_unseen = '';
+ if($page_mode === 'list') {
- if($is_owner) {
+ /**
+ * 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($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 +317,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 {