Merge pull request #10659 from annando/gravity
Adding gravity to avoid notices
This commit is contained in:
commit
622c030526
|
@ -47,13 +47,9 @@ class Fetch extends BaseModule
|
||||||
$guid = $parameters['guid'];
|
$guid = $parameters['guid'];
|
||||||
|
|
||||||
// Fetch the item
|
// 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,
|
$condition = ['origin' => true, 'private' => [Item::PUBLIC, Item::UNLISTED], 'guid' => $guid,
|
||||||
'gravity' => [GRAVITY_PARENT, GRAVITY_COMMENT], 'network' => [Protocol::DFRN, Protocol::DIASPORA]];
|
'gravity' => [GRAVITY_PARENT, GRAVITY_COMMENT], 'network' => [Protocol::DFRN, Protocol::DIASPORA]];
|
||||||
$item = Post::selectFirst($fields, $condition);
|
$item = Post::selectFirst([], $condition);
|
||||||
if (empty($item)) {
|
if (empty($item)) {
|
||||||
$condition = ['guid' => $guid, 'network' => [Protocol::DFRN, Protocol::DIASPORA]];
|
$condition = ['guid' => $guid, 'network' => [Protocol::DFRN, Protocol::DIASPORA]];
|
||||||
$item = Post::selectFirst(['author-link'], $condition);
|
$item = Post::selectFirst(['author-link'], $condition);
|
||||||
|
@ -82,7 +78,7 @@ class Fetch extends BaseModule
|
||||||
if ($item['gravity'] == GRAVITY_PARENT) {
|
if ($item['gravity'] == GRAVITY_PARENT) {
|
||||||
$status = Diaspora::buildStatus($item, $user);
|
$status = Diaspora::buildStatus($item, $user);
|
||||||
} else {
|
} else {
|
||||||
$status = Diaspora::constructComment($item, $user);
|
$status = ['type' => 'comment', 'message' => Diaspora::createCommentSignature($item)];
|
||||||
}
|
}
|
||||||
|
|
||||||
$xml = Diaspora::buildPostXml($status["type"], $status["message"]);
|
$xml = Diaspora::buildPostXml($status["type"], $status["message"]);
|
||||||
|
|
|
@ -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
|
||||||
*/
|
*/
|
||||||
public static function constructComment(array $item, array $owner)
|
private static function constructComment(array $item, array $owner)
|
||||||
{
|
{
|
||||||
$cachekey = "diaspora:constructComment:".$item['guid'];
|
$cachekey = "diaspora:constructComment:".$item['guid'];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user