]> git.mxchange.org Git - friendica.git/commitdiff
Fix: Don't change the owner of your own posts
authorMichael <heluecht@pirati.ca>
Sat, 22 Aug 2020 17:30:14 +0000 (17:30 +0000)
committerMichael <heluecht@pirati.ca>
Sat, 22 Aug 2020 17:30:14 +0000 (17:30 +0000)
src/Model/Item.php

index a77568c7099d2d4e4041850c1c95b95d64bde150..ccccc592e6b25515ed66ae4bdb8b267bdf8729fc 100644 (file)
@@ -2009,7 +2009,8 @@ class Item
         */
        private static function setOwnerforResharedItem(array $item)
        {
-               $parent = self::selectFirst(['id', 'owner-id', 'author-id', 'author-link'], ['uri-id' => $item['parent-uri-id'], 'uid' => $item['uid']]);
+               $parent = self::selectFirst(['id', 'owner-id', 'author-id', 'author-link', 'origin'],
+                       ['uri-id' => $item['parent-uri-id'], 'uid' => $item['uid']]);
                if (!DBA::isResult($parent)) {
                        Logger::error('Parent not found', ['uri-id' => $item['parent-uri-id'], 'uid' => $item['uid']]);
                        return;
@@ -2026,14 +2027,14 @@ class Item
                        return;
                }
 
-               if (($author['contact-type'] != Contact::TYPE_COMMUNITY) && Contact::isSharing($parent['author-link'], $item['uid'])) {
-                       logger::info('The parent author is a user contact: quit', ['author' => $parent['author-link'], 'uid' => $item['uid']]);
+               if (($author['contact-type'] != Contact::TYPE_COMMUNITY) && (Contact::isSharing($parent['author-link'], $item['uid']) || $item['origin'])) {
+                       logger::info('The parent author is a following contact: quit', ['author' => $parent['author-link'], 'uid' => $item['uid']]);
                        return;
                }
 
                $cid = Contact::getIdForURL($author['url'], $item['uid']);
                if (empty($cid) || !Contact::isSharing($cid, $item['uid'])) {
-                       logger::info('The resharer is not a user contact: quit', ['resharer' => $author['url'], 'uid' => $item['uid']]);
+                       logger::info('The resharer is not a following contact: quit', ['resharer' => $author['url'], 'uid' => $item['uid']]);
                        return;
                }