Merge pull request #10654 from annando/issue-10651

Issue 10651: remote comments appeared as own posts
This commit is contained in:
Hypolite Petovan 2021-09-02 19:53:22 -04:00 committed by GitHub
commit e6ce767442
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View 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

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