Merge pull request #10659 from annando/gravity

Adding gravity to avoid notices
This commit is contained in:
Hypolite Petovan 2021-09-03 09:27:40 -04:00 committed by GitHub
commit 622c030526
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 7 deletions

View File

@ -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',
'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"]);

View File

@ -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'];