aboutsummaryrefslogtreecommitdiffstats
path: root/include/items.php
diff options
context:
space:
mode:
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) {