From 6bb8b63da0b6d901dd21bc1d668ad55bd071c8aa Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 3 Sep 2021 04:05:29 +0000 Subject: [PATCH 1/3] Adding gravity to avoid notices --- src/Module/Diaspora/Fetch.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Module/Diaspora/Fetch.php b/src/Module/Diaspora/Fetch.php index ff4a3ac8da..3f0de6166f 100644 --- a/src/Module/Diaspora/Fetch.php +++ b/src/Module/Diaspora/Fetch.php @@ -49,7 +49,7 @@ class Fetch extends BaseModule // Fetch the item $fields = [ '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' + '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]]; From 307cfef12b5daf5e0dc637dc332eb039630d3ef2 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 3 Sep 2021 04:09:02 +0000 Subject: [PATCH 2/3] Select all fields --- src/Module/Diaspora/Fetch.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/Module/Diaspora/Fetch.php b/src/Module/Diaspora/Fetch.php index 3f0de6166f..265d9508e4 100644 --- a/src/Module/Diaspora/Fetch.php +++ b/src/Module/Diaspora/Fetch.php @@ -47,13 +47,9 @@ class Fetch extends BaseModule $guid = $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); From ce6f6978bdd50792875ca2b7e9b4123936b85f45 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 3 Sep 2021 04:20:32 +0000 Subject: [PATCH 3/3] Use the correct function is adviced ... --- src/Module/Diaspora/Fetch.php | 2 +- src/Protocol/Diaspora.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Module/Diaspora/Fetch.php b/src/Module/Diaspora/Fetch.php index 265d9508e4..55eeea9b55 100644 --- a/src/Module/Diaspora/Fetch.php +++ b/src/Module/Diaspora/Fetch.php @@ -78,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"]); diff --git a/src/Protocol/Diaspora.php b/src/Protocol/Diaspora.php index f4dc997e62..48d7a3371c 100644 --- a/src/Protocol/Diaspora.php +++ b/src/Protocol/Diaspora.php @@ -3614,7 +3614,7 @@ class Diaspora * @return array|false The data for a comment * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public static function constructComment(array $item, array $owner) + private static function constructComment(array $item, array $owner) { $cachekey = "diaspora:constructComment:".$item['guid'];