]> git.mxchange.org Git - friendica.git/blobdiff - src/Content/Item.php
Remove DI dependency in Object\Api\Mastodon\Instance
[friendica.git] / src / Content / Item.php
index e2942e27e62b0f14d59b35149d39a6e7b9d82b66..ab5ff1698f8db1f9d8bf8ae1dd406f14e93d902d 100644 (file)
@@ -1049,8 +1049,6 @@ class Item
                        Tag::createImplicitMentions($post['uri-id'], $post['thr-parent-id']);
                }
 
-               ActivityPub\Transmitter::storeReceiversForItem($post);
-
                Hook::callAll('post_local_end', $post);
 
                $author = DBA::selectFirst('contact', ['thumb'], ['uid' => $post['uid'], 'self' => true]);
@@ -1074,8 +1072,18 @@ class Item
 
        public function copyPermissions(int $fromUriId, int $toUriId)
        {
+               $from        = Post::selectFirstPost(['author-id'], ['uri-id' => $fromUriId]);
+               $from_author = DBA::selectFirst('account-view', ['ap-followers'], ['id' => $from['author-id']]);
+               $to          = Post::selectFirstPost(['author-id'], ['uri-id' => $toUriId]);
+               $to_author   = DBA::selectFirst('account-view', ['ap-followers'], ['id' => $to['author-id']]);
+
                $existing = array_column(Tag::getByURIId($toUriId, [Tag::TO, Tag::CC, Tag::BCC]), 'url');
+
                foreach (Tag::getByURIId($fromUriId, [Tag::TO, Tag::CC, Tag::BCC]) as $receiver) {
+                       if ($receiver['url'] == $from_author['ap-followers']) {
+                               $receiver['url']  = $to_author['ap-followers'];
+                               $receiver['name'] = trim(parse_url($receiver['url'], PHP_URL_PATH), '/');
+                       }
                        if (in_array($receiver['url'], $existing)) {
                                continue;
                        }