aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2022-05-06 08:24:17 +0000
committerMario <mario@mariovavti.com>2022-05-06 08:24:17 +0000
commitf299391aa1592590e63d493540f50ba0d7891fb0 (patch)
treeb464d9e6684a3b286d3fa6ba872ef5b23260da72
parentc334fc9d22c7f2633d9b7e8d9e0fae1f2bb40547 (diff)
downloadvolse-hubzilla-f299391aa1592590e63d493540f50ba0d7891fb0.tar.gz
volse-hubzilla-f299391aa1592590e63d493540f50ba0d7891fb0.tar.bz2
volse-hubzilla-f299391aa1592590e63d493540f50ba0d7891fb0.zip
fix core issue #1676 and a liked/disliked/commented confusion
-rw-r--r--Zotlabs/Lib/Enotify.php25
-rw-r--r--Zotlabs/Module/Sse_bs.php24
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)