Don't fetch sugestions for the system user / catch error on contact timeline
This commit is contained in:
parent
146f874c2e
commit
1d00947bcd
|
@ -323,6 +323,10 @@ class Relation
|
||||||
*/
|
*/
|
||||||
static public function getSuggestions(int $uid, int $start = 0, int $limit = 80): array
|
static public function getSuggestions(int $uid, int $start = 0, int $limit = 80): array
|
||||||
{
|
{
|
||||||
|
if ($uid == 0) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
$cid = Contact::getPublicIdByUserId($uid);
|
$cid = Contact::getPublicIdByUserId($uid);
|
||||||
$totallimit = $start + $limit;
|
$totallimit = $start + $limit;
|
||||||
$contacts = [];
|
$contacts = [];
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
namespace Friendica\Module\Api\Mastodon\Accounts;
|
namespace Friendica\Module\Api\Mastodon\Accounts;
|
||||||
|
|
||||||
|
use Friendica\Core\Logger;
|
||||||
use Friendica\Core\Protocol;
|
use Friendica\Core\Protocol;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
|
@ -113,7 +114,11 @@ class Statuses extends BaseApi
|
||||||
$statuses = [];
|
$statuses = [];
|
||||||
while ($item = Post::fetch($items)) {
|
while ($item = Post::fetch($items)) {
|
||||||
self::setBoundaries($item['uri-id']);
|
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);
|
DBA::close($items);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user