From 18a62c01d43ed431baa72f3aa19b28a86ec2a094 Mon Sep 17 00:00:00 2001 From: Mike Macgirvin Date: Sat, 11 May 2024 12:20:32 +1000 Subject: [PATCH 1/2] hack to provide better delivery filtering to projects with more primitive permissions models. --- include/permissions.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/include/permissions.php b/include/permissions.php index 8991cb6bb..e6a706788 100644 --- a/include/permissions.php +++ b/include/permissions.php @@ -522,12 +522,18 @@ function check_deliver_permissions($uid, $arr) $r = q("select * from abconfig where chan = %d and cat = 'system' and k = 'my_perms' and v not like '%%deliver_stream%%'", intval($uid) ); - $disallowed = ids_to_array($r,'xchan'); + $willNotSend = ids_to_array($r,'xchan'); + + // Find actors accepting our posts + $r = q("select * from abconfig where chan = %d and cat = 'system' and k = 'their_perms' and v like '%%send_stream%%'", + intval($uid) + ); + $theyAccept = ids_to_array($r, 'xchan'); // Filter the recipient list accordingly. if ($arr) { foreach ($arr as $x) { - if (! in_array($x, $disallowed)) { + if (in_array($x, $theyAccept) && ! in_array($x, $willNotSend)) { $result[] = $x; } } From 6041cab29795f1598348088b4b68be2a07fb6d99 Mon Sep 17 00:00:00 2001 From: Mike Macgirvin Date: Sat, 11 May 2024 12:48:40 +1000 Subject: [PATCH 2/2] apply same patch to hyperdrive --- src/Daemon/Notifier.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Daemon/Notifier.php b/src/Daemon/Notifier.php index 1e86b19d4..5da368ba1 100644 --- a/src/Daemon/Notifier.php +++ b/src/Daemon/Notifier.php @@ -500,6 +500,7 @@ class Notifier implements DaemonInterface foreach ($r as $rv) { self::$recipients[] = $rv['abook_xchan']; } + self::$recipients = check_deliver_permissions($target_item['uid'], self::$recipients); } } else {