filter out of range ancestor

Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
pull/1712/head
Maxence Lange 2023-04-03 14:45:32 -01:00
rodzic 14942d9668
commit c38073cb2b
1 zmienionych plików z 7 dodań i 4 usunięć

Wyświetl plik

@ -355,7 +355,6 @@ class StreamService {
* @param int $nid
*
* @return array
* @throws StreamNotFoundException
*/
public function getContextByNid(int $nid): array {
$curr = $post = $this->streamRequest->getStreamByNid($nid);
@ -366,9 +365,13 @@ class StreamService {
break;
}
$curr = $this->streamRequest->getStreamById($curr->getInReplyTo());
$curr->setExportFormat(ACore::FORMAT_LOCAL);
$ancestors[] = $curr;
try {
$curr = $this->streamRequest->getStreamById($curr->getInReplyTo(), true);
$curr->setExportFormat(ACore::FORMAT_LOCAL);
$ancestors[] = $curr;
} catch (StreamNotFoundException $e) {
break; // ancestor might be out of range for viewer
}
}
return [