aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Lib/Enotify.php
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2018-02-12 22:48:53 +0100
committerMario Vavti <mario@mariovavti.com>2018-02-12 22:48:53 +0100
commitb7fb78245aca724248cc721134a360276a9f6d9c (patch)
tree76fe5d8d8e3fbf68345c9d426ee6c23089d62c06 /Zotlabs/Lib/Enotify.php
parent571a9642a546b7cd6757884be72de0226cfb006e (diff)
downloadvolse-hubzilla-b7fb78245aca724248cc721134a360276a9f6d9c.tar.gz
volse-hubzilla-b7fb78245aca724248cc721134a360276a9f6d9c.tar.bz2
volse-hubzilla-b7fb78245aca724248cc721134a360276a9f6d9c.zip
if always_show_in_notices is set to 1 also show likes and dislikes
Diffstat (limited to 'Zotlabs/Lib/Enotify.php')
-rw-r--r--Zotlabs/Lib/Enotify.php43
1 files changed, 28 insertions, 15 deletions
diff --git a/Zotlabs/Lib/Enotify.php b/Zotlabs/Lib/Enotify.php
index 5cf4ec31d..5820c8b0c 100644
--- a/Zotlabs/Lib/Enotify.php
+++ b/Zotlabs/Lib/Enotify.php
@@ -112,6 +112,8 @@ class Enotify {
}
+ $always_show_in_notices = get_pconfig($recip['channel_id'],'system','always_show_in_notices');
+
// e.g. "your post", "David's photo", etc.
$possess_desc = t('%s <!item_type!>');
@@ -134,12 +136,22 @@ class Enotify {
$itemlink = $params['link'];
- // ignore like/unlike activity on posts - they probably require a separate notification preference
+ $action = 'commented on';
+
+ if(array_key_exists('item',$params) && (! visible_activity($params['item']))) {
+
+ if(! $always_show_in_notices) {
+ logger('notification: not a visible activity. Ignoring.');
+ pop_lang();
+ return;
+ }
+
+ if(activity_match($params['item']['verb'], ACTIVITY_LIKE))
+ $action = 'liked';
+
+ if(activity_match($params['item']['verb'], ACTIVITY_DISLIKE))
+ $action = 'disliked';
- if (array_key_exists('item',$params) && (! visible_activity($params['item']))) {
- logger('notification: not a visible activity. Ignoring.');
- pop_lang();
- return;
}
$parent_mid = $params['parent_mid'];
@@ -181,26 +193,29 @@ class Enotify {
//$possess_desc = str_replace('<!item_type!>',$possess_desc);
// "a post"
- $dest_str = sprintf(t('%1$s, %2$s commented on [zrl=%3$s]a %4$s[/zrl]'),
+ $dest_str = sprintf(t('%1$s, %2$s %3$s [zrl=%4$s]a %5$s[/zrl]'),
$recip['channel_name'],
'[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]',
+ $action,
$itemlink,
$item_post_type);
// "George Bull's post"
if($p)
- $dest_str = sprintf(t('%1$s, %2$s commented on [zrl=%3$s]%4$s\'s %5$s[/zrl]'),
+ $dest_str = sprintf(t('%1$s, %2$s %3$s [zrl=%4$s]%5$s\'s %6$s[/zrl]'),
$recip['channel_name'],
'[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]',
+ $action,
$itemlink,
$p[0]['author']['xchan_name'],
$item_post_type);
// "your post"
if($p[0]['owner']['xchan_name'] == $p[0]['author']['xchan_name'] && intval($p[0]['item_wall']))
- $dest_str = sprintf(t('%1$s, %2$s commented on [zrl=%3$s]your %4$s[/zrl]'),
+ $dest_str = sprintf(t('%1$s, %2$s %3$s [zrl=%3$s]your %5$s[/zrl]'),
$recip['channel_name'],
'[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]',
+ $action,
$itemlink,
$item_post_type);
@@ -231,12 +246,12 @@ class Enotify {
$itemlink = $params['link'];
- // ignore like/unlike activity on posts - they probably require a separate notification preference
-
if (array_key_exists('item',$params) && (! activity_match($params['item']['verb'],ACTIVITY_LIKE))) {
- logger('notification: not a like activity. Ignoring.');
- pop_lang();
- return;
+ if(! $always_show_in_notices) {
+ logger('notification: not a visible activity. Ignoring.');
+ pop_lang();
+ return;
+ }
}
$parent_mid = $params['parent_mid'];
@@ -496,8 +511,6 @@ class Enotify {
// Another option would be to not add them to the DB, and change how emails are handled
// (probably would be better that way)
- $always_show_in_notices = get_pconfig($recip['channel_id'],'system','always_show_in_notices');
-
if (!$always_show_in_notices) {
if (($params['type'] == NOTIFY_WALL) || ($params['type'] == NOTIFY_MAIL) || ($params['type'] == NOTIFY_INTRO)) {
$seen = 1;