diff options
-rw-r--r-- | Zotlabs/Lib/Enotify.php | 25 | ||||
-rw-r--r-- | Zotlabs/Module/Sse_bs.php | 24 |
2 files changed, 40 insertions, 9 deletions
diff --git a/Zotlabs/Lib/Enotify.php b/Zotlabs/Lib/Enotify.php index 1421c72ae..59e4d9a4e 100644 --- a/Zotlabs/Lib/Enotify.php +++ b/Zotlabs/Lib/Enotify.php @@ -256,8 +256,8 @@ class Enotify { $itemlink = $params['link']; - if (array_key_exists('item',$params) && activity_match($params['item']['verb'],ACTIVITY_LIKE)) { - if(! $always_show_in_notices || !($vnotify & VNOTIFY_LIKE)) { + if (array_key_exists('item',$params) && (activity_match($params['item']['verb'], ACTIVITY_LIKE) || activity_match($params['item']['verb'], ACTIVITY_DISLIKE))) { + if(! $always_show_in_notices || !($vnotify & VNOTIFY_LIKE) || !feature_enabled($recip['channel_id'], 'dislike')) { logger('notification: not a visible activity. Ignoring.'); pop_lang(); return; @@ -291,22 +291,29 @@ class Enotify { ); } + if (!$p) { + pop_lang(); + return; + } + xchan_query($p); -//@@FIXME $p can be null (line 285) $item_post_type = item_post_type($p[0]); // $private = $p[0]['item_private']; $parent_id = $p[0]['id']; $parent_item = $p[0]; + $verb = ((activity_match($params['item']['verb'], ACTIVITY_DISLIKE)) ? t('disliked') : t('liked')); // "your post" if($p[0]['owner']['xchan_name'] === $p[0]['author']['xchan_name'] && intval($p[0]['item_wall'])) - $dest_str = sprintf(t('%1$s liked [zrl=%2$s]your %3$s[/zrl]'), + $dest_str = sprintf(t('%1$s %2$s [zrl=%3$s]your %4$s[/zrl]'), '[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]', + $verb, $itemlink, - $item_post_type); + $item_post_type + ); else { pop_lang(); return; @@ -824,6 +831,14 @@ class Enotify { $itemem_text = sprintf( t('repeated %s\'s post'), '[bdi]' . $item['author']['xchan_name'] . '[/bdi]'); } + if($item['verb'] === ACTIVITY_LIKE) { + $itemem_text = sprintf( t('liked %s\'s post'), '[bdi]' . $item['author']['xchan_name'] . '[/bdi]'); + } + + if($item['verb'] === ACTIVITY_DISLIKE) { + $itemem_text = sprintf( t('disliked %s\'s post'), '[bdi]' . $item['author']['xchan_name'] . '[/bdi]'); + } + if(in_array($item['obj_type'], ['Document', 'Video', 'Audio', 'Image'])) { $itemem_text = t('shared a file with you'); } diff --git a/Zotlabs/Module/Sse_bs.php b/Zotlabs/Module/Sse_bs.php index 3a13b0a6f..ad9be0938 100644 --- a/Zotlabs/Module/Sse_bs.php +++ b/Zotlabs/Module/Sse_bs.php @@ -160,8 +160,12 @@ class Sse_bs extends Controller { $offset = self::$offset; $sql_extra = ''; - if(! (self::$vnotify & VNOTIFY_LIKE)) + if (!(self::$vnotify & VNOTIFY_LIKE)) { $sql_extra = " AND verb NOT IN ('" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') "; + } + elseif (!feature_enabled(self::$uid, 'dislike')) { + $sql_extra = " AND verb NOT IN ('" . dbesc(ACTIVITY_DISLIKE) . "') "; + } $sql_extra2 = ''; if(self::$xchans) @@ -236,8 +240,12 @@ class Sse_bs extends Controller { $offset = self::$offset; $sql_extra = ''; - if(! (self::$vnotify & VNOTIFY_LIKE)) + if (!(self::$vnotify & VNOTIFY_LIKE)) { $sql_extra = " AND verb NOT IN ('" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') "; + } + elseif (!feature_enabled(self::$uid, 'dislike')) { + $sql_extra = " AND verb NOT IN ('" . dbesc(ACTIVITY_DISLIKE) . "') "; + } $sql_extra2 = ''; if(self::$xchans) @@ -311,8 +319,12 @@ class Sse_bs extends Controller { $offset = self::$offset; $sql_extra = ''; - if(! (self::$vnotify & VNOTIFY_LIKE)) + if (!(self::$vnotify & VNOTIFY_LIKE)) { $sql_extra = " AND verb NOT IN ('" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') "; + } + elseif (!feature_enabled(self::$uid, 'dislike')) { + $sql_extra = " AND verb NOT IN ('" . dbesc(ACTIVITY_DISLIKE) . "') "; + } $sql_extra2 = ''; if(self::$xchans) @@ -398,8 +410,12 @@ class Sse_bs extends Controller { $sys = get_sys_channel(); $sql_extra = ''; - if(! (self::$vnotify & VNOTIFY_LIKE)) + if (!(self::$vnotify & VNOTIFY_LIKE)) { $sql_extra = " AND verb NOT IN ('" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') "; + } + elseif (!feature_enabled(self::$uid, 'dislike')) { + $sql_extra = " AND verb NOT IN ('" . dbesc(ACTIVITY_DISLIKE) . "') "; + } $sql_extra2 = ''; if(self::$xchans) |