Merge pull request #13957 from annando/issue-13940

Issue 13940: handle posts that can't be found in contexts
This commit is contained in:
Hypolite Petovan 2024-03-03 13:42:00 -05:00 committed by GitHub
commit ea4e66c74c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -129,7 +129,11 @@ class Context extends BaseApi
$display_quotes = self::appSupportsQuotes();
foreach (array_slice($ancestors, 0, $request['limit']) as $ancestor) {
try {
$statuses['ancestors'][] = DI::mstdnStatus()->createFromUriId($ancestor, $uid, $display_quotes);
} catch (\Throwable $th) {
$this->logger->info('Post not fetchable', ['uri-id' => $ancestor, 'uid' => $uid, 'error' => $th]);
}
}
$descendants = array_diff(self::getChildren($id, $children), $deleted);
@ -137,7 +141,11 @@ class Context extends BaseApi
asort($descendants);
foreach (array_slice($descendants, 0, $request['limit']) as $descendant) {
try {
$statuses['descendants'][] = DI::mstdnStatus()->createFromUriId($descendant, $uid, $display_quotes);
} catch (\Throwable $th) {
$this->logger->info('Post not fetchable', ['uri-id' => $descendant, 'uid' => $uid, 'error' => $th]);
}
}
$this->jsonExit($statuses);