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