aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-11-17 15:18:06 -0800
committerfriendica <info@friendica.com>2014-11-17 15:18:06 -0800
commitc0ad4763b30238aead8f1187efd669080c52a149 (patch)
tree7d9330457593d90f540004d09087fde59f2b4429 /mod
parentb11ed7f88e4683315a4f5aa02692cb61facf32a7 (diff)
downloadvolse-hubzilla-c0ad4763b30238aead8f1187efd669080c52a149.tar.gz
volse-hubzilla-c0ad4763b30238aead8f1187efd669080c52a149.tar.bz2
volse-hubzilla-c0ad4763b30238aead8f1187efd669080c52a149.zip
add unseen count and way to mark unseen to list mode. Also fix automatic mark of unseen so as to work with list mode.
Diffstat (limited to 'mod')
-rw-r--r--mod/network.php29
-rw-r--r--mod/ping.php16
2 files changed, 35 insertions, 10 deletions
diff --git a/mod/network.php b/mod/network.php
index d6c19eca7..c79ff8d6a 100644
--- a/mod/network.php
+++ b/mod/network.php
@@ -317,6 +317,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 +419,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 +450,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..20cfbe120 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,14 +165,14 @@ 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)
);
break;
case 'all_events':
- $r = q("update event set `ignore` = 1 where `ignore` = 0 and uid = %d",
+ $r = q("update event set ignore = 1 where ignore = 0 and uid = %d",
intval(local_user())
);
break;
@@ -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())
+ );
+ }
+
/**