Issue 10651: remote comments appeared as own posts
This commit is contained in:
parent
c4307c85e1
commit
64fd94fc74
2 changed files with 9 additions and 3 deletions
|
@ -51,7 +51,8 @@ class Fetch extends BaseModule
|
||||||
'uid', 'title', 'body', 'guid', 'contact-id', 'private', 'created', 'received', 'app', 'location', 'coord', 'network',
|
'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'
|
'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);
|
$item = Post::selectFirst($fields, $condition);
|
||||||
if (empty($item)) {
|
if (empty($item)) {
|
||||||
$condition = ['guid' => $guid, 'network' => [Protocol::DFRN, Protocol::DIASPORA]];
|
$condition = ['guid' => $guid, 'network' => [Protocol::DFRN, Protocol::DIASPORA]];
|
||||||
|
@ -78,7 +79,12 @@ class Fetch extends BaseModule
|
||||||
throw new HTTPException\NotFoundException();
|
throw new HTTPException\NotFoundException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($item['gravity'] == GRAVITY_PARENT) {
|
||||||
$status = Diaspora::buildStatus($item, $user);
|
$status = Diaspora::buildStatus($item, $user);
|
||||||
|
} else {
|
||||||
|
$status = Diaspora::constructComment($item, $user);
|
||||||
|
}
|
||||||
|
|
||||||
$xml = Diaspora::buildPostXml($status["type"], $status["message"]);
|
$xml = Diaspora::buildPostXml($status["type"], $status["message"]);
|
||||||
|
|
||||||
// Send the envelope
|
// Send the envelope
|
||||||
|
|
|
@ -3614,7 +3614,7 @@ class Diaspora
|
||||||
* @return array|false The data for a comment
|
* @return array|false The data for a comment
|
||||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
* @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'];
|
$cachekey = "diaspora:constructComment:".$item['guid'];
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue