]> git.mxchange.org Git - friendica.git/commitdiff
Don't fetch sugestions for the system user / catch error on contact timeline
authorMichael <heluecht@pirati.ca>
Thu, 1 Dec 2022 07:07:59 +0000 (07:07 +0000)
committerMichael <heluecht@pirati.ca>
Thu, 1 Dec 2022 07:07:59 +0000 (07:07 +0000)
src/Model/Contact/Relation.php
src/Module/Api/Mastodon/Accounts/Statuses.php

index bae59f48c57e727df52fbc7ac53548264be3c44e..5616148fa0183e2d774d3c70f585c80218faced9 100644 (file)
@@ -323,6 +323,10 @@ class Relation
         */
        static public function getSuggestions(int $uid, int $start = 0, int $limit = 80): array
        {
+               if ($uid == 0) {
+                       return [];
+               }
+
                $cid = Contact::getPublicIdByUserId($uid);
                $totallimit = $start + $limit;
                $contacts = [];
index b244c56fb258dd71a68d0bceb5b83664aad73a12..7de8699401dc14da7f7b96eeb710815e8c503376 100644 (file)
@@ -21,6 +21,7 @@
 
 namespace Friendica\Module\Api\Mastodon\Accounts;
 
+use Friendica\Core\Logger;
 use Friendica\Core\Protocol;
 use Friendica\Core\System;
 use Friendica\Database\DBA;
@@ -113,7 +114,11 @@ class Statuses extends BaseApi
                $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);
+                       } catch (\Throwable $th) {
+                               Logger::info('Post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'error' => $th]);
+                       }
                }
                DBA::close($items);