Merge pull request #13676 from MrPetovan/bug/13673-markers-json-output

Change return value to stdClass of Module\Api\Mastodon\Markers->fetchTimelines
This commit is contained in:
Michael Vogel 2023-11-28 02:10:49 +01:00 committed by GitHub
commit bb97539a28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,9 +21,7 @@
namespace Friendica\Module\Api\Mastodon; namespace Friendica\Module\Api\Mastodon;
use Friendica\Core\System;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Module\BaseApi; use Friendica\Module\BaseApi;
use Friendica\Util\DateTimeFormat; use Friendica\Util\DateTimeFormat;
@ -76,12 +74,12 @@ class Markers extends BaseApi
$this->jsonExit($this->fetchTimelines($application['id'], $uid)); $this->jsonExit($this->fetchTimelines($application['id'], $uid));
} }
private function fetchTimelines(int $application_id, int $uid) private function fetchTimelines(int $application_id, int $uid): \stdClass
{ {
$values = []; $values = new \stdClass();
$markers = DBA::select('application-marker', [], ['application-id' => $application_id, 'uid' => $uid]); $markers = DBA::select('application-marker', [], ['application-id' => $application_id, 'uid' => $uid]);
while ($marker = DBA::fetch($markers)) { while ($marker = DBA::fetch($markers)) {
$values[$marker['timeline']] = [ $values->{$marker['timeline']} = [
'last_read_id' => $marker['last_read_id'], 'last_read_id' => $marker['last_read_id'],
'version' => $marker['version'], 'version' => $marker['version'],
'updated_at' => $marker['updated_at'] 'updated_at' => $marker['updated_at']