this should fix mention notification that aren't plus tagged

This commit is contained in:
friendica 2014-04-19 22:53:42 -07:00
parent 167bf252c0
commit 8d950b4e06

View File

@ -2450,16 +2450,24 @@ function tag_deliver($uid,$item_id) {
$body = preg_replace('/\[share(.*?)\[\/share\]/','',$body); $body = preg_replace('/\[share(.*?)\[\/share\]/','',$body);
$pattern = '/@\!?\[zrl\=' . preg_quote($term['url'],'/') . '\]' . preg_quote($u[0]['channel_name'] . '+','/') . '\[\/zrl\]/'; $tagged = false;
$plustagged = false;
if(! preg_match($pattern,$body,$matches)) { $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(! ($tagged || $plustagged)) {
logger('tag_deliver: mention was in a reshare - ignoring'); logger('tag_deliver: mention was in a reshare - ignoring');
return; return;
} }
// All good. // Valid tag. Send a notification
// Send a notification
require_once('include/enotify.php'); require_once('include/enotify.php');
notification(array( notification(array(
@ -2472,6 +2480,14 @@ function tag_deliver($uid,$item_id) {
'otype' => 'item' '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')) { if(! perm_is_allowed($uid,$item['author_xchan'],'tag_deliver')) {
logger('tag_delivery denied for uid ' . $uid . ' and xchan ' . $item['author_xchan']); logger('tag_delivery denied for uid ' . $uid . ' and xchan ' . $item['author_xchan']);