aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2024-04-17 07:39:22 +0000
committerMario <mario@mariovavti.com>2024-04-17 07:39:22 +0000
commit716013633ecb09b1c8fd950275f0cbf272b1fe43 (patch)
tree47a63ebdec8af0d0b1ce3b0238dcf4611a27ae40
parent1ca91c49aaa8565f9d97e2e354fa6851179ca4d8 (diff)
downloadvolse-hubzilla-716013633ecb09b1c8fd950275f0cbf272b1fe43.tar.gz
volse-hubzilla-716013633ecb09b1c8fd950275f0cbf272b1fe43.tar.bz2
volse-hubzilla-716013633ecb09b1c8fd950275f0cbf272b1fe43.zip
passing an empty filter to deliverable_abook_xchans() will return all deliverable abook xchans - we do not want this in this place. also add some docu
-rw-r--r--include/items.php17
1 files changed, 13 insertions, 4 deletions
diff --git a/include/items.php b/include/items.php
index efc45db38..2300f70ef 100644
--- a/include/items.php
+++ b/include/items.php
@@ -36,10 +36,10 @@ require_once('include/permissions.php');
* @param boolean $include_groups
* @return array containing the recipients
*/
-function collect_recipients($item, &$private_envelope,$include_groups = true) {
+function collect_recipients($item, &$private_envelope, $include_groups = true) {
$private_envelope = ((intval($item['item_private'])) ? true : false);
- $recipients = array();
+ $recipients = [];
if($item['allow_cid'] || $item['allow_gid'] || $item['deny_cid'] || $item['deny_gid']) {
@@ -54,8 +54,15 @@ function collect_recipients($item, &$private_envelope,$include_groups = true) {
$allow_groups = [];
}
- $raw_recipients = array_unique(array_merge($allow_people, $allow_groups));
- $recipients = deliverable_abook_xchans($item['uid'], $raw_recipients);
+ $recipients = array_unique(array_merge($allow_people, $allow_groups));
+
+ if ($recipients) {
+ // deliverable_abook_xchans() will return all deliverable xchans
+ // if passed an empty array as 2nd argument (no filtering).
+ // Hence only call it if we do actually have any recipients.
+ $recipients = deliverable_abook_xchans($item['uid'], $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
@@ -201,6 +208,8 @@ function collect_recipients($item, &$private_envelope,$include_groups = true) {
$recipients[] = $item['owner_xchan'];
}
+hz_syslog(print_r($recipients, true));
+
return $recipients;
}