]> git.mxchange.org Git - friendica.git/blobdiff - src/Protocol/ActivityPub/Transmitter.php
Merge pull request #10372 from annando/forum-handling
[friendica.git] / src / Protocol / ActivityPub / Transmitter.php
index 83e3d35a9782c971ec4b84d085aaefdf27995c3b..76bc295d1c4f814d34f1f64a8effdad56c7eb3b1 100644 (file)
@@ -533,6 +533,8 @@ class Transmitter
                        $actor_profile = APContact::getByURL($item['author-link']);
                }
 
+               $exclusive = false;
+
                $terms = Tag::getByURIId($item['uri-id'], [Tag::MENTION, Tag::IMPLICIT_MENTION, Tag::EXCLUSIVE_MENTION]);
 
                if ($item['private'] != Item::PRIVATE) {
@@ -557,6 +559,9 @@ class Transmitter
                        foreach ($terms as $term) {
                                $profile = APContact::getByURL($term['url'], false);
                                if (!empty($profile)) {
+                                       if ($term['type'] == Tag::EXCLUSIVE_MENTION) {
+                                               $exclusive = true;
+                                       }
                                        $data['to'][] = $profile['url'];
                                }
                        }
@@ -612,7 +617,7 @@ class Transmitter
                                                                        $data['cc'][] = $actor_profile['followers'];
                                                                }
                                                        }
-                                               } else {
+                                               } elseif (!$exclusive) {
                                                        // Public thread parent post always are directed to the followers
                                                        if (($item['private'] != Item::PRIVATE) && !$forum_mode) {
                                                                $data['cc'][] = $actor_profile['followers'];
@@ -748,10 +753,6 @@ class Transmitter
 
                $contacts = DBA::select('contact', ['id', 'url', 'network', 'protocol', 'gsid'], $condition);
                while ($contact = DBA::fetch($contacts)) {
-                       if (Contact::isLocal($contact['url'])) {
-                               continue;
-                       }
-
                        if (!self::isAPContact($contact, $networks)) {
                                continue;
                        }
@@ -766,7 +767,7 @@ class Transmitter
 
                        $profile = APContact::getByURL($contact['url'], false);
                        if (!empty($profile)) {
-                               if (empty($profile['sharedinbox']) || $personal) {
+                               if (empty($profile['sharedinbox']) || $personal || Contact::isLocal($contact['url'])) {
                                        $target = $profile['inbox'];
                                } else {
                                        $target = $profile['sharedinbox'];
@@ -829,15 +830,11 @@ class Transmitter
                                if ($item_profile && ($receiver == $item_profile['followers']) && ($uid == $profile_uid)) {
                                        $inboxes = array_merge($inboxes, self::fetchTargetInboxesforUser($uid, $personal, self::isAPPost($last_id)));
                                } else {
-                                       if (Contact::isLocal($receiver)) {
-                                               continue;
-                                       }
-
                                        $profile = APContact::getByURL($receiver, false);
                                        if (!empty($profile)) {
                                                $contact = Contact::getByURLForUser($receiver, $uid, false, ['id']);
 
-                                               if (empty($profile['sharedinbox']) || $personal || $blindcopy) {
+                                               if (empty($profile['sharedinbox']) || $personal || $blindcopy || Contact::isLocal($receiver)) {
                                                        $target = $profile['inbox'];
                                                } else {
                                                        $target = $profile['sharedinbox'];