]> git.mxchange.org Git - friendica.git/commitdiff
Issue 10651: remote comments appeared as own posts
authorMichael <heluecht@pirati.ca>
Thu, 2 Sep 2021 05:57:50 +0000 (05:57 +0000)
committerMichael <heluecht@pirati.ca>
Thu, 2 Sep 2021 05:57:50 +0000 (05:57 +0000)
src/Module/Diaspora/Fetch.php
src/Protocol/Diaspora.php

index 17f664baf8c8a1c29ff743439ff64430541de541..ff4a3ac8da92333b364467d18dfe8ff3fed89b31 100644 (file)
@@ -51,7 +51,8 @@ class Fetch extends BaseModule
                        'uid', 'title', 'body', 'guid', 'contact-id', 'private', 'created', 'received', 'app', 'location', 'coord', 'network',
                        'event-id', 'resource-id', 'author-link', 'author-avatar', 'author-name', 'plink', 'owner-link', 'uri-id'
                ];
-               $condition = ['wall' => true, 'private' => [Item::PUBLIC, Item::UNLISTED], 'guid' => $guid, 'network' => [Protocol::DFRN, Protocol::DIASPORA]];
+               $condition = ['origin' => true, 'private' => [Item::PUBLIC, Item::UNLISTED], 'guid' => $guid,
+                       'gravity' => [GRAVITY_PARENT, GRAVITY_COMMENT], 'network' => [Protocol::DFRN, Protocol::DIASPORA]];
                $item = Post::selectFirst($fields, $condition);
                if (empty($item)) {
                        $condition = ['guid' => $guid, 'network' => [Protocol::DFRN, Protocol::DIASPORA]];
@@ -78,7 +79,12 @@ class Fetch extends BaseModule
                        throw new HTTPException\NotFoundException();
                }
 
-               $status = Diaspora::buildStatus($item, $user);
+               if ($item['gravity'] == GRAVITY_PARENT) {
+                       $status = Diaspora::buildStatus($item, $user);
+               } else {
+                       $status = Diaspora::constructComment($item, $user);
+               }
+
                $xml = Diaspora::buildPostXml($status["type"], $status["message"]);
 
                // Send the envelope
index 48d7a3371cbfd49c62700b2da5fd30701f940213..f4dc997e6276266300d52621c13ff0a77df089f2 100644 (file)
@@ -3614,7 +3614,7 @@ class Diaspora
         * @return array|false The data for a comment
         * @throws \Friendica\Network\HTTPException\InternalServerErrorException
         */
-       private static function constructComment(array $item, array $owner)
+       public static function constructComment(array $item, array $owner)
        {
                $cachekey = "diaspora:constructComment:".$item['guid'];