Merge pull request #12978 from annando/issue-12977

Issue 12977: Ensure to fetch quoted posts
This commit is contained in:
Hypolite Petovan 2023-04-08 08:54:47 -04:00 committed by GitHub
commit c80566157e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

@ -840,6 +840,9 @@ class Processor
if ($id) {
$shared_item = Post::selectFirst(['uri-id'], ['id' => $id]);
$item['quote-uri-id'] = $shared_item['uri-id'];
} elseif ($uri_id = ItemURI::getIdByURI($activity['quote-url'], false)) {
Logger::info('Quote was not fetched but the uri-id existed', ['guid' => $item['guid'], 'uri-id' => $item['uri-id'], 'quote' => $activity['quote-url'], 'uri-id' => $uri_id]);
$item['quote-uri-id'] = $uri_id;
} else {
Logger::info('Quote was not fetched', ['guid' => $item['guid'], 'uri-id' => $item['uri-id'], 'quote' => $activity['quote-url']]);
}

View file

@ -630,7 +630,7 @@ class Receiver
$object_data['object_activity'] = $activity;
}
if (($type == 'as:Create') && $trust_source) {
if (($type == 'as:Create') && $trust_source && !in_array($completion, [self::COMPLETION_MANUAL, self::COMPLETION_ANNOUNCE])) {
if (self::hasArrived($object_data['object_id'])) {
Logger::info('The activity already arrived.', ['id' => $object_data['object_id']]);
return true;
@ -641,6 +641,8 @@ class Receiver
Logger::info('The activity is already added.', ['id' => $object_data['object_id']]);
return true;
}
} elseif (($type == 'as:Create') && $trust_source && !self::hasArrived($object_data['object_id'])) {
self::addArrivedId($object_data['object_id']);
}
$decouple = DI::config()->get('system', 'decoupled_receiver') && !in_array($completion, [self::COMPLETION_MANUAL, self::COMPLETION_ANNOUNCE]);