]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Api/Mastodon/Timelines/ListTimeline.php
Catch not fetchable posts
[friendica.git] / src / Module / Api / Mastodon / Timelines / ListTimeline.php
index df6fdb39d896a87f4c09e604334a58bcebdec9cd..a8de13056ec45fb0b1367c31813453f8c63b6bf3 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2022, the Friendica project
+ * @copyright Copyright (C) 2010-2023, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -21,6 +21,7 @@
 
 namespace Friendica\Module\Api\Mastodon\Timelines;
 
+use Friendica\Core\Logger;
 use Friendica\Core\System;
 use Friendica\Database\DBA;
 use Friendica\DI;
@@ -96,10 +97,16 @@ class ListTimeline extends BaseApi
 
                $items = Post::selectForUser($uid, ['uri-id'], $condition, $params);
 
+               $display_quotes = self::appSupportsQuotes();
+
                $statuses = [];
                while ($item = Post::fetch($items)) {
                        self::setBoundaries($item['uri-id']);
-                       $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid);
+                       try {
+                               $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, $display_quotes);
+                       } catch (\Throwable $th) {
+                               Logger::info('Post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'error' => $th]);
+                       }
                }
                DBA::close($items);