]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Diaspora/Fetch.php
Merge remote-tracking branch 'upstream/2021.12-rc' into lemmy
[friendica.git] / src / Module / Diaspora / Fetch.php
index 3f0de6166f651238eeefd413635809fca31a23d5..97cbb5878f65ed30628505fa6fbdc496e2cc448e 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2021, the Friendica project
+ * @copyright Copyright (C) 2010-2022, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -38,22 +38,18 @@ use Friendica\Util\Strings;
  */
 class Fetch extends BaseModule
 {
-       public static function rawContent(array $parameters = [])
+       protected function rawContent(array $request = [])
        {
-               if (empty($parameters['guid'])) {
+               if (empty($this->parameters['guid'])) {
                        throw new HTTPException\NotFoundException();
                }
 
-               $guid = $parameters['guid'];
+               $guid = $this->parameters['guid'];
 
                // Fetch the item
-               $fields = [
-                       'uid', 'title', 'body', 'guid', 'contact-id', 'private', 'created', 'received', 'app', 'location', 'coord', 'network',
-                       'gravity', 'event-id', 'resource-id', 'author-link', 'author-avatar', 'author-name', 'plink', 'owner-link', 'uri-id'
-               ];
                $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);
+               $item = Post::selectFirst([], $condition);
                if (empty($item)) {
                        $condition = ['guid' => $guid, 'network' => [Protocol::DFRN, Protocol::DIASPORA]];
                        $item = Post::selectFirst(['author-link'], $condition);
@@ -82,7 +78,7 @@ class Fetch extends BaseModule
                if ($item['gravity'] == GRAVITY_PARENT) {
                        $status = Diaspora::buildStatus($item, $user);
                } else {
-                       $status = Diaspora::constructComment($item, $user);
+                       $status = ['type' => 'comment', 'message' => Diaspora::createCommentSignature($item)];
                }
 
                $xml = Diaspora::buildPostXml($status["type"], $status["message"]);