]> git.mxchange.org Git - friendica.git/commitdiff
We now use bcc for the acl block
authorMichael <heluecht@pirati.ca>
Wed, 24 Oct 2018 20:06:57 +0000 (20:06 +0000)
committerMichael <heluecht@pirati.ca>
Wed, 24 Oct 2018 20:06:57 +0000 (20:06 +0000)
src/Protocol/ActivityPub/Transmitter.php

index 2b6f87e665dc85681b84ac191a30632eb5425354..2a40838b911ab0109033a0cd4e55b5cbc2aaa33a 100644 (file)
@@ -312,7 +312,7 @@ class Transmitter
                // For now only send to these contacts:
                $networks = [Protocol::ACTIVITYPUB, Protocol::OSTATUS];
 
-               $data = ['to' => [], 'cc' => []];
+               $data = ['to' => [], 'cc' => [], 'bcc' => []];
 
                $data = array_merge($data, self::fetchPermissionBlockFromConversation($item));
 
@@ -350,7 +350,7 @@ class Transmitter
                        foreach ($receiver_list as $receiver) {
                                $contact = DBA::selectFirst('contact', ['url'], ['id' => $receiver, 'network' => $networks]);
                                if (DBA::isResult($contact) && !empty($profile = APContact::getByURL($contact['url'], false))) {
-                                       $data['cc'][] = $profile['url'];
+                                       $data['bcc'][] = $profile['url'];
                                }
                        }
                }
@@ -384,6 +384,7 @@ class Transmitter
 
                $data['to'] = array_unique($data['to']);
                $data['cc'] = array_unique($data['cc']);
+               $data['bcc'] = array_unique($data['bcc']);
 
                if (($key = array_search($item['author-link'], $data['to'])) !== false) {
                        unset($data['to'][$key]);
@@ -393,16 +394,33 @@ class Transmitter
                        unset($data['cc'][$key]);
                }
 
+               if (($key = array_search($item['author-link'], $data['bcc'])) !== false) {
+                       unset($data['bcc'][$key]);
+               }
+
                foreach ($data['to'] as $to) {
                        if (($key = array_search($to, $data['cc'])) !== false) {
                                unset($data['cc'][$key]);
                        }
+
+                       if (($key = array_search($to, $data['bcc'])) !== false) {
+                               unset($data['bcc'][$key]);
+                       }
                }
 
+               foreach ($data['cc'] as $cc) {
+                       if (($key = array_search($cc, $data['bcc'])) !== false) {
+                               unset($data['bcc'][$key]);
+                       }
+               }
+
+               $receivers = ['to' => array_values($data['to']), 'cc' => array_values($data['cc']), 'bcc' => array_values($data['bcc'])];
+
                if (!$blindcopy) {
+                       unset($receivers['bcc']);
                }
 
-               return ['to' => array_values($data['to']), 'cc' => array_values($data['cc'])];
+               return $receivers;
        }
 
        /**