From 8d950b4e0628f448393d4d5166caa5d5fe5a1a9b Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 19 Apr 2014 22:53:42 -0700 Subject: this should fix mention notification that aren't plus tagged --- include/items.php | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'include/items.php') diff --git a/include/items.php b/include/items.php index 8df090e0b..487666e36 100755 --- a/include/items.php +++ b/include/items.php @@ -2450,16 +2450,24 @@ function tag_deliver($uid,$item_id) { $body = preg_replace('/\[share(.*?)\[\/share\]/','',$body); + $tagged = false; + $plustagged = false; + + $pattern = '/@\!?\[zrl\=' . preg_quote($term['url'],'/') . '\]' . preg_quote($u[0]['channel_name'],'/') . '\[\/zrl\]/'; + if(preg_match($pattern,$body,$matches)) + $tagged = true; + $pattern = '/@\!?\[zrl\=' . preg_quote($term['url'],'/') . '\]' . preg_quote($u[0]['channel_name'] . '+','/') . '\[\/zrl\]/'; + if(preg_match($pattern,$body,$matches)) + $plustagged = true; - if(! preg_match($pattern,$body,$matches)) { + if(! ($tagged || $plustagged)) { logger('tag_deliver: mention was in a reshare - ignoring'); return; } - - // All good. - // Send a notification + + // Valid tag. Send a notification require_once('include/enotify.php'); notification(array( @@ -2472,6 +2480,14 @@ function tag_deliver($uid,$item_id) { 'otype' => 'item' )); + // Just a normal tag? + + if(! $plustagged) { + logger('tag_deliver: not a plus tag', LOGGER_DEBUG); + return; + } + + // plustagged - keep going, next check permissions if(! perm_is_allowed($uid,$item['author_xchan'],'tag_deliver')) { logger('tag_delivery denied for uid ' . $uid . ' and xchan ' . $item['author_xchan']); -- cgit v1.2.3