Don't always fetch parent posts

This commit is contained in:
Michael 2022-08-03 04:51:57 +00:00
parent 23ef4a99bb
commit 3463e34693
3 changed files with 19 additions and 14 deletions

View file

@ -265,12 +265,15 @@ class Processor
/**
* Prepares data for a message
*
* @param array $activity Activity array
* @param array $activity Activity array
* @param bool $fetch_parents
*
* @return array Internal item
*
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public static function createItem(array $activity): array
public static function createItem(array $activity, bool $fetch_parents = true): array
{
$item = [];
$item['verb'] = Activity::POST;
@ -305,7 +308,7 @@ class Processor
return [];
}
if (empty($activity['directmessage']) && ($activity['id'] != $activity['reply-to-id']) && !Post::exists(['uri' => $activity['reply-to-id']])) {
if ($fetch_parents && empty($activity['directmessage']) && ($activity['id'] != $activity['reply-to-id']) && !Post::exists(['uri' => $activity['reply-to-id']])) {
$result = self::fetchParent($activity);
if (!empty($result)) {
if (($item['thr-parent'] != $result) && Post::exists(['uri' => $result])) {