From a30cfd8fec638a0f1d428c456f593e773f18b1bf Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 27 Dec 2022 16:08:08 +0000 Subject: filter approvals --- Zotlabs/Module/Sse_bs.php | 20 ++++++++++++++++++++ Zotlabs/Widget/Messages.php | 5 ++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/Zotlabs/Module/Sse_bs.php b/Zotlabs/Module/Sse_bs.php index ca9630c02..052870cc9 100644 --- a/Zotlabs/Module/Sse_bs.php +++ b/Zotlabs/Module/Sse_bs.php @@ -173,6 +173,9 @@ class Sse_bs extends Controller { $item_normal = item_normal(); + // FEP-5624 filter approvals for comments + $approvals = " AND verb NOT IN ('" . dbesc(ACTIVITY_ATTEND) . "', 'Accept', '" . dbesc(ACTIVITY_ATTENDNO) . "', 'Reject') "; + if ($notifications) { $items = q("SELECT * FROM item WHERE uid = %d @@ -181,6 +184,7 @@ class Sse_bs extends Controller { AND obj_type NOT IN ('Document', 'Video', 'Audio', 'Image') AND author_xchan != '%s' $item_normal + $approvals $sql_extra $sql_extra2 ORDER BY created DESC LIMIT $limit OFFSET $offset", @@ -210,6 +214,7 @@ class Sse_bs extends Controller { AND obj_type NOT IN ('Document', 'Video', 'Audio', 'Image') AND author_xchan != '%s' $item_normal + $approvals $sql_extra LIMIT 100", intval(self::$uid), dbesc(self::$ob_hash) @@ -253,6 +258,9 @@ class Sse_bs extends Controller { $item_normal = item_normal(); + // FEP-5624 filter approvals for comments + $approvals = " AND verb NOT IN ('" . dbesc(ACTIVITY_ATTEND) . "', 'Accept', '" . dbesc(ACTIVITY_ATTENDNO) . "', 'Reject') "; + if ($notifications) { $items = q("SELECT * FROM item WHERE uid = %d @@ -261,6 +269,7 @@ class Sse_bs extends Controller { AND obj_type NOT IN ('Document', 'Video', 'Audio', 'Image') AND author_xchan != '%s' $item_normal + $approvals $sql_extra $sql_extra2 ORDER BY created DESC LIMIT $limit OFFSET $offset", @@ -288,6 +297,7 @@ class Sse_bs extends Controller { $r = q("SELECT id FROM item WHERE uid = %d and item_unseen = 1 AND item_private = 2 $item_normal + $approvals $sql_extra AND author_xchan != '%s' LIMIT 100", intval(self::$uid), @@ -333,6 +343,9 @@ class Sse_bs extends Controller { $item_normal = item_normal(); + // FEP-5624 filter approvals for comments + $approvals = " AND verb NOT IN ('" . dbesc(ACTIVITY_ATTEND) . "', 'Accept', '" . dbesc(ACTIVITY_ATTENDNO) . "', 'Reject') "; + if ($notifications) { $items = q("SELECT * FROM item WHERE uid = %d @@ -341,6 +354,7 @@ class Sse_bs extends Controller { AND obj_type NOT IN ('Document', 'Video', 'Audio', 'Image') AND author_xchan != '%s' $item_normal + $approvals $sql_extra $sql_extra2 ORDER BY created DESC LIMIT $limit OFFSET $offset", @@ -368,6 +382,7 @@ class Sse_bs extends Controller { $r = q("SELECT id FROM item WHERE uid = %d and item_unseen = 1 AND item_wall = 1 AND item_private IN (0, 1) $item_normal + $approvals $sql_extra AND author_xchan != '%s' LIMIT 100", intval(self::$uid), @@ -430,6 +445,9 @@ class Sse_bs extends Controller { $item_normal = item_normal(); + // FEP-5624 filter approvals for comments + $approvals = " AND verb NOT IN ('" . dbesc(ACTIVITY_ATTEND) . "', 'Accept', '" . dbesc(ACTIVITY_ATTENDNO) . "', 'Reject') "; + if ($notifications) { $items = q("SELECT * FROM item WHERE true $uids @@ -438,6 +456,7 @@ class Sse_bs extends Controller { AND author_xchan != '%s' AND created > '%s' $item_normal + $approvals $sql_extra $sql_extra2 ORDER BY created DESC LIMIT $limit OFFSET $offset", @@ -465,6 +484,7 @@ class Sse_bs extends Controller { WHERE true $uids AND created > '%s' $item_normal + $approvals $sql_extra AND author_xchan != '%s' LIMIT 100", dbescdate($_SESSION['static_loadtime']), diff --git a/Zotlabs/Widget/Messages.php b/Zotlabs/Widget/Messages.php index a7e3b08fc..8c413e16e 100644 --- a/Zotlabs/Widget/Messages.php +++ b/Zotlabs/Widget/Messages.php @@ -91,8 +91,11 @@ class Messages { $type_sql = ' AND i.item_private IN (0, 1) '; } + // FEP-5624 filter approvals for comments + $approvals_c = " AND c.verb NOT IN ('" . dbesc(ACTIVITY_ATTEND) . "', 'Accept', '" . dbesc(ACTIVITY_ATTENDNO) . "', 'Reject') "; + $items = q("SELECT *, - (SELECT count(*) FROM item c WHERE c.uid = %d AND c.parent = i.parent AND c.item_unseen = 1 AND c.item_thread_top = 0 $item_normal_c $vnotify_sql_c) AS unseen_count + (SELECT count(*) FROM item c WHERE c.uid = %d AND c.parent = i.parent AND c.item_unseen = 1 AND c.item_thread_top = 0 $item_normal_c $approvals_c $vnotify_sql_c) AS unseen_count FROM item i WHERE i.uid = %d AND i.created <= '%s' $type_sql -- cgit v1.2.3