aboutsummaryrefslogtreecommitdiffstats
path: root/include/items.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2023-07-01 11:03:26 +0000
committerMario <mario@mariovavti.com>2023-07-01 11:03:26 +0000
commit4f03272a5f4c33f6c893b6f56f43fe5e839173b3 (patch)
tree98c13a7fabccf9aa1dbe164532db68703d7d6dbf /include/items.php
parent7755936a2ef31d8ad9976d6fe80eb85f0b816f70 (diff)
downloadvolse-hubzilla-4f03272a5f4c33f6c893b6f56f43fe5e839173b3.tar.gz
volse-hubzilla-4f03272a5f4c33f6c893b6f56f43fe5e839173b3.tar.bz2
volse-hubzilla-4f03272a5f4c33f6c893b6f56f43fe5e839173b3.zip
unify code for selecting deliverable abook xchans
Diffstat (limited to 'include/items.php')
-rw-r--r--include/items.php23
1 files changed, 7 insertions, 16 deletions
diff --git a/include/items.php b/include/items.php
index c6aeaa0ed..c832a3075 100644
--- a/include/items.php
+++ b/include/items.php
@@ -53,35 +53,28 @@ function collect_recipients($item, &$private_envelope,$include_groups = true) {
$allow_groups = [];
}
- $recipients = array_unique(array_merge($allow_people,$allow_groups));
+ $raw_recipients = array_unique(array_merge($allow_people, $allow_groups));
+ $recipients = deliverable_abook_xchans($item['uid'], $raw_recipients);
// if you specifically deny somebody but haven't allowed anybody, we'll allow everybody in your
// address book minus the denied connections. The post is still private and can't be seen publicly
// as that would allow the denied person to see the post by logging out.
- if((! $item['allow_cid']) && (! $item['allow_gid'])) {
- $r = q("select * from abook where abook_channel = %d and abook_self = 0 and abook_pending = 0 and abook_archived = 0 ",
- intval($item['uid'])
- );
-
- if($r) {
- foreach($r as $rr) {
- $recipients[] = $rr['abook_xchan'];
- }
- }
+ if(!$item['allow_cid'] && !$item['allow_gid']) {
+ $recipients = deliverable_abook_xchans($item['uid']);
}
$deny_people = expand_acl($item['deny_cid']);
$deny_groups = AccessList::expand(expand_acl($item['deny_gid']));
- $deny = array_unique(array_merge($deny_people,$deny_groups));
+ $deny = array_unique(array_merge($deny_people, $deny_groups));
// Don't deny anybody if nobody was allowed (e.g. they were all filtered out)
// That would lead to array_diff doing the wrong thing.
// This will result in a private post that won't be delivered to anybody.
if($recipients && $deny)
- $recipients = array_diff($recipients,$deny);
+ $recipients = array_diff($recipients, $deny);
$private_envelope = true;
}
@@ -112,9 +105,7 @@ function collect_recipients($item, &$private_envelope,$include_groups = true) {
if ($hookinfo['recipients']) {
$r = $hookinfo['recipients'];
} else {
- $r = q("select abook_xchan, xchan_network from abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d and abook_self = 0 and abook_pending = 0 and abook_archived = 0 and abook_not_here = 0 and xchan_network not in ('anon', 'token', 'rss')",
- intval($item['uid'])
- );
+ $r = deliverable_abook_xchans($item['uid'], [], false);
}
if($r) {