From 0061ac8584feb6d18962518263ab18617dbf8dc5 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sun, 22 Oct 2017 21:01:58 +0200 Subject: do not show seen notifys in notifications - show them in mod notifications instead. Update notifications count also on notifications updates --- Zotlabs/Module/Ping.php | 37 ++++++++++--------------------------- 1 file changed, 10 insertions(+), 27 deletions(-) (limited to 'Zotlabs/Module/Ping.php') diff --git a/Zotlabs/Module/Ping.php b/Zotlabs/Module/Ping.php index 5f44b3c20..c91659f2f 100644 --- a/Zotlabs/Module/Ping.php +++ b/Zotlabs/Module/Ping.php @@ -258,37 +258,20 @@ class Ping extends \Zotlabs\Web\Controller { * dropdown menu. */ if(argc() > 1 && argv(1) === 'notify') { - $t = q("select count(*) as total from notify where uid = %d and seen = 0", + $t = q("select * from notify where uid = %d and seen = 0 order by created desc", intval(local_channel()) ); - if($t && intval($t[0]['total']) > 49) { - $z = q("select * from notify where uid = %d - and seen = 0 order by created desc limit 50", - intval(local_channel()) - ); - } else { - $z1 = q("select * from notify where uid = %d - and seen = 0 order by created desc limit 50", - intval(local_channel()) - ); - $z2 = q("select * from notify where uid = %d - and seen = 1 order by created desc limit %d", - intval(local_channel()), - intval(50 - intval($t[0]['total'])) - ); - $z = array_merge($z1,$z2); - } - if(count($z)) { - foreach($z as $zz) { + if($t) { + foreach($t as $tt) { $notifs[] = array( - 'notify_link' => z_root() . '/notify/view/' . $zz['id'], - 'name' => $zz['xname'], - 'url' => $zz['url'], - 'photo' => $zz['photo'], - 'when' => relative_date($zz['created']), - 'hclass' => (($zz['seen']) ? 'notify-seen' : 'notify-unseen'), - 'message' => strip_tags(bbcode($zz['msg'])) + 'notify_link' => z_root() . '/notify/view/' . $tt['id'], + 'name' => $tt['xname'], + 'url' => $tt['url'], + 'photo' => $tt['photo'], + 'when' => relative_date($tt['created']), + 'hclass' => (($tt['seen']) ? 'notify-seen' : 'notify-unseen'), + 'message' => strip_tags(bbcode($tt['msg'])) ); } } -- cgit v1.2.3 From 0ce7358f0f00cb000562dc34be13459eb5779c18 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 3 Nov 2017 13:49:58 +0100 Subject: update item_normal() to not include ACTIVITY_OBJ_FILE obj_type --- Zotlabs/Module/Ping.php | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'Zotlabs/Module/Ping.php') diff --git a/Zotlabs/Module/Ping.php b/Zotlabs/Module/Ping.php index c91659f2f..5e2d04c1f 100644 --- a/Zotlabs/Module/Ping.php +++ b/Zotlabs/Module/Ping.php @@ -169,15 +169,13 @@ class Ping extends \Zotlabs\Web\Controller { $r = q("SELECT * FROM item WHERE uid = %d AND author_xchan != '%s' - AND obj_type != '%s' AND item_unseen = 1 AND created > '" . datetime_convert('UTC','UTC',$_SESSION['static_loadtime']) . "' $item_normal ORDER BY created DESC LIMIT 300", intval($sys['channel_id']), - dbesc(get_observer_hash()), - dbesc(ACTIVITY_OBJ_FILE) + dbesc(get_observer_hash()) ); if($r) { @@ -313,11 +311,9 @@ class Ping extends \Zotlabs\Web\Controller { $r = q("SELECT * FROM item WHERE item_unseen = 1 and uid = %d $item_normal AND author_xchan != '%s' - AND obj_type != '%s' ORDER BY created DESC limit 300", intval(local_channel()), - dbesc($ob_hash), - dbesc(ACTIVITY_OBJ_FILE) + dbesc($ob_hash) ); if($r) { @@ -487,11 +483,9 @@ class Ping extends \Zotlabs\Web\Controller { $r = q("SELECT id, item_wall FROM item WHERE item_unseen = 1 and uid = %d $item_normal - AND author_xchan != '%s' - AND obj_type != '%s'", + AND author_xchan != '%s'", intval(local_channel()), - dbesc($ob_hash), - dbesc(ACTIVITY_OBJ_FILE) + dbesc($ob_hash) ); if($r) { -- cgit v1.2.3 From 9cd715bbbf8b02fad21b1f4982c8de7c0e575154 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 6 Nov 2017 09:34:20 +0100 Subject: fix unable to mark all messages read --- Zotlabs/Module/Ping.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module/Ping.php') diff --git a/Zotlabs/Module/Ping.php b/Zotlabs/Module/Ping.php index 5e2d04c1f..3c6dda1e9 100644 --- a/Zotlabs/Module/Ping.php +++ b/Zotlabs/Module/Ping.php @@ -219,7 +219,7 @@ class Ping extends \Zotlabs\Web\Controller { intval(local_channel()) ); break; - case 'messages': + case 'mail': $r = q("update mail set mail_seen = 1 where mail_seen = 0 and channel_id = %d ", intval(local_channel()) ); -- cgit v1.2.3 From 601ebee9692c3bb552100f08f789824c68bdd5e0 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 17 Nov 2017 10:40:34 +0100 Subject: strip author name from notify messages in notifications - fix issue #911 --- Zotlabs/Module/Ping.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'Zotlabs/Module/Ping.php') diff --git a/Zotlabs/Module/Ping.php b/Zotlabs/Module/Ping.php index 3c6dda1e9..b18ff84b8 100644 --- a/Zotlabs/Module/Ping.php +++ b/Zotlabs/Module/Ping.php @@ -262,6 +262,13 @@ class Ping extends \Zotlabs\Web\Controller { if($t) { foreach($t as $tt) { + + $message = trim(strip_tags(bbcode($tt['msg']))); + $count = 1; + + if(strpos($message, $tt['xname']) === 0) + $message = str_replace($tt['xname'], '', $message, $count); + $notifs[] = array( 'notify_link' => z_root() . '/notify/view/' . $tt['id'], 'name' => $tt['xname'], @@ -269,7 +276,7 @@ class Ping extends \Zotlabs\Web\Controller { 'photo' => $tt['photo'], 'when' => relative_date($tt['created']), 'hclass' => (($tt['seen']) ? 'notify-seen' : 'notify-unseen'), - 'message' => strip_tags(bbcode($tt['msg'])) + 'message' => $message ); } } -- cgit v1.2.3 From 76af8fa754467e13bcd8c83620ac1c174e777170 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 17 Nov 2017 13:54:53 +0100 Subject: inroduce the HQ module - a module with the potential to become a nice landing page for hubzilla. It is nothing more than a downgraded mod display atm. --- Zotlabs/Module/Ping.php | 1 - 1 file changed, 1 deletion(-) (limited to 'Zotlabs/Module/Ping.php') diff --git a/Zotlabs/Module/Ping.php b/Zotlabs/Module/Ping.php index b18ff84b8..39f123d21 100644 --- a/Zotlabs/Module/Ping.php +++ b/Zotlabs/Module/Ping.php @@ -262,7 +262,6 @@ class Ping extends \Zotlabs\Web\Controller { if($t) { foreach($t as $tt) { - $message = trim(strip_tags(bbcode($tt['msg']))); $count = 1; -- cgit v1.2.3 From 8a4ee0506cf8acd61c716976fb6760504ce2e8bc Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 17 Nov 2017 21:25:18 +0100 Subject: use substr() instead of str_replace() --- Zotlabs/Module/Ping.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'Zotlabs/Module/Ping.php') diff --git a/Zotlabs/Module/Ping.php b/Zotlabs/Module/Ping.php index 39f123d21..d05acba6c 100644 --- a/Zotlabs/Module/Ping.php +++ b/Zotlabs/Module/Ping.php @@ -263,10 +263,9 @@ class Ping extends \Zotlabs\Web\Controller { if($t) { foreach($t as $tt) { $message = trim(strip_tags(bbcode($tt['msg']))); - $count = 1; if(strpos($message, $tt['xname']) === 0) - $message = str_replace($tt['xname'], '', $message, $count); + $message = substr($message, strlen($tt['xname']) + 1); $notifs[] = array( 'notify_link' => z_root() . '/notify/view/' . $tt['id'], -- cgit v1.2.3 From fbc57fa8e36e468abe81e4f3d72b3115cbdd794c Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sat, 18 Nov 2017 22:16:06 +0100 Subject: some more work on mod hq --- Zotlabs/Module/Ping.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Zotlabs/Module/Ping.php') diff --git a/Zotlabs/Module/Ping.php b/Zotlabs/Module/Ping.php index d05acba6c..a6df1d3a6 100644 --- a/Zotlabs/Module/Ping.php +++ b/Zotlabs/Module/Ping.php @@ -274,6 +274,8 @@ class Ping extends \Zotlabs\Web\Controller { 'photo' => $tt['photo'], 'when' => relative_date($tt['created']), 'hclass' => (($tt['seen']) ? 'notify-seen' : 'notify-unseen'), + 'b64mid' => 'b64.' . base64url_encode(basename($tt['link'])), + 'notify_id' => $tt['id'], 'message' => $message ); } -- cgit v1.2.3 From 727b49c8aba0997212b0c4adeb064bd5706a0b2c Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sun, 19 Nov 2017 20:37:58 +0100 Subject: do not double encode already encoded mid --- Zotlabs/Module/Ping.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'Zotlabs/Module/Ping.php') diff --git a/Zotlabs/Module/Ping.php b/Zotlabs/Module/Ping.php index a6df1d3a6..f98626ffb 100644 --- a/Zotlabs/Module/Ping.php +++ b/Zotlabs/Module/Ping.php @@ -267,6 +267,11 @@ class Ping extends \Zotlabs\Web\Controller { if(strpos($message, $tt['xname']) === 0) $message = substr($message, strlen($tt['xname']) + 1); + + $mid = basename($tt['link']); + + $b64mid = ((strpos($mid, 'b64.' === 0)) ? $mid : 'b64.' . base64url_encode($mid)); + $notifs[] = array( 'notify_link' => z_root() . '/notify/view/' . $tt['id'], 'name' => $tt['xname'], @@ -274,7 +279,7 @@ class Ping extends \Zotlabs\Web\Controller { 'photo' => $tt['photo'], 'when' => relative_date($tt['created']), 'hclass' => (($tt['seen']) ? 'notify-seen' : 'notify-unseen'), - 'b64mid' => 'b64.' . base64url_encode(basename($tt['link'])), + 'b64mid' => $b64mid, 'notify_id' => $tt['id'], 'message' => $message ); -- cgit v1.2.3 From 744960d36d636f8840f8bcea13283ea7f97cc4e6 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sun, 19 Nov 2017 20:40:50 +0100 Subject: only provide notify id if otype == item --- Zotlabs/Module/Ping.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module/Ping.php') diff --git a/Zotlabs/Module/Ping.php b/Zotlabs/Module/Ping.php index f98626ffb..8644b8326 100644 --- a/Zotlabs/Module/Ping.php +++ b/Zotlabs/Module/Ping.php @@ -280,7 +280,7 @@ class Ping extends \Zotlabs\Web\Controller { 'when' => relative_date($tt['created']), 'hclass' => (($tt['seen']) ? 'notify-seen' : 'notify-unseen'), 'b64mid' => $b64mid, - 'notify_id' => $tt['id'], + 'notify_id' => (($tt['otype'] == 'item') ? $tt['id'] : ''), 'message' => $message ); } -- cgit v1.2.3 From 250d947667b1500633d80b043ac3760be21446fc Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sun, 19 Nov 2017 21:51:21 -0800 Subject: cloud tiles: use folder-o for folders and set the icon colour to something a bit less harsh than the link colour for system icons. Dark solid blue folders are a bit overwhelming, as is the default text_colour (black) --- Zotlabs/Module/Ping.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Zotlabs/Module/Ping.php') diff --git a/Zotlabs/Module/Ping.php b/Zotlabs/Module/Ping.php index 8644b8326..406e554d1 100644 --- a/Zotlabs/Module/Ping.php +++ b/Zotlabs/Module/Ping.php @@ -492,10 +492,11 @@ class Ping extends \Zotlabs\Web\Controller { $t3 = dba_timer(); if($vnotify & (VNOTIFY_NETWORK|VNOTIFY_CHANNEL)) { + $r = q("SELECT id, item_wall FROM item WHERE item_unseen = 1 and uid = %d $item_normal - AND author_xchan != '%s'", + AND author_xchan != '%s' $sql_extra ", intval(local_channel()), dbesc($ob_hash) ); -- cgit v1.2.3 From 87eaa6d8e5a5fece531a8ce191f8e89e90f673c2 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 24 Nov 2017 15:01:34 +0100 Subject: some more work on mod hq --- Zotlabs/Module/Ping.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module/Ping.php') diff --git a/Zotlabs/Module/Ping.php b/Zotlabs/Module/Ping.php index 406e554d1..84f9d2a21 100644 --- a/Zotlabs/Module/Ping.php +++ b/Zotlabs/Module/Ping.php @@ -496,7 +496,7 @@ class Ping extends \Zotlabs\Web\Controller { $r = q("SELECT id, item_wall FROM item WHERE item_unseen = 1 and uid = %d $item_normal - AND author_xchan != '%s' $sql_extra ", + AND author_xchan != '%s'", intval(local_channel()), dbesc($ob_hash) ); -- cgit v1.2.3 From dae0107dd0e1caa460866b5debdc6de912bfd819 Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 3 Dec 2017 12:31:41 +0100 Subject: fix some pubstream on/off weirdness --- Zotlabs/Module/Ping.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module/Ping.php') diff --git a/Zotlabs/Module/Ping.php b/Zotlabs/Module/Ping.php index 84f9d2a21..c1bce0d51 100644 --- a/Zotlabs/Module/Ping.php +++ b/Zotlabs/Module/Ping.php @@ -140,7 +140,7 @@ class Ping extends \Zotlabs\Web\Controller { db_utcnow(), db_quoteinterval('3 MINUTE') ); - $discover_tab_on = ((get_config('system','disable_discover_tab') != 1) ? true : false); + $discover_tab_on = ((get_config('system','disable_discover_tab') || get_config('system','disable_discover_tab') === false) ? false : true); $notify_pubs = ((local_channel()) ? ($vnotify & VNOTIFY_PUBS) && $discover_tab_on : $discover_tab_on); if($notify_pubs) { -- cgit v1.2.3 From ab3b126ff6a3dd76292c6c96482ed6835df966f6 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 18 Dec 2017 12:46:37 +0100 Subject: notifications: only handle item otype notify_ids --- Zotlabs/Module/Ping.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Module/Ping.php') diff --git a/Zotlabs/Module/Ping.php b/Zotlabs/Module/Ping.php index c1bce0d51..a3f6cdfec 100644 --- a/Zotlabs/Module/Ping.php +++ b/Zotlabs/Module/Ping.php @@ -279,8 +279,8 @@ class Ping extends \Zotlabs\Web\Controller { 'photo' => $tt['photo'], 'when' => relative_date($tt['created']), 'hclass' => (($tt['seen']) ? 'notify-seen' : 'notify-unseen'), - 'b64mid' => $b64mid, - 'notify_id' => (($tt['otype'] == 'item') ? $tt['id'] : ''), + 'b64mid' => (($tt['otype'] == 'item') ? $b64mid : 'undefined'), + 'notify_id' => (($tt['otype'] == 'item') ? $tt['id'] : 'undefined'), 'message' => $message ); } -- cgit v1.2.3