Update ApiV1Controller, add bookmarked to timeline entities

This commit is contained in:
Daniel Supernault 2023-08-21 22:43:30 -06:00
parent 526807f01c
commit ca746717cb
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -2193,6 +2193,7 @@ class ApiV1Controller extends Controller
if($pid) {
$status['favourited'] = (bool) LikeService::liked($pid, $s['id']);
$status['reblogged'] = (bool) ReblogService::get($pid, $status['id']);
$status['bookmarked'] = (bool) BookmarkService::get($pid, $status['id']);
}
return $status;
})
@ -2203,6 +2204,7 @@ class ApiV1Controller extends Controller
if(!empty($status['reblog'])) {
$status['reblog']['favourited'] = (bool) LikeService::liked($pid, $status['reblog']['id']);
$status['reblog']['reblogged'] = (bool) ReblogService::get($pid, $status['reblog']['id']);
$status['bookmarked'] = (bool) BookmarkService::get($pid, $status['id']);
}
return $status;
@ -2244,6 +2246,7 @@ class ApiV1Controller extends Controller
if($pid) {
$status['favourited'] = (bool) LikeService::liked($pid, $s['id']);
$status['reblogged'] = (bool) ReblogService::get($pid, $status['id']);
$status['bookmarked'] = (bool) BookmarkService::get($pid, $status['id']);
}
return $status;
})
@ -2254,6 +2257,7 @@ class ApiV1Controller extends Controller
if(!empty($status['reblog'])) {
$status['reblog']['favourited'] = (bool) LikeService::liked($pid, $status['reblog']['id']);
$status['reblog']['reblogged'] = (bool) ReblogService::get($pid, $status['reblog']['id']);
$status['bookmarked'] = (bool) BookmarkService::get($pid, $status['id']);
}
return $status;
@ -2378,6 +2382,7 @@ class ApiV1Controller extends Controller
if($user) {
$status['favourited'] = (bool) LikeService::liked($user->profile_id, $k);
$status['reblogged'] = (bool) ReblogService::get($user->profile_id, $status['id']);
$status['bookmarked'] = (bool) BookmarkService::get($user->profile_id, $status['id']);
}
return $status;
})
@ -3615,8 +3620,8 @@ class ApiV1Controller extends Controller
abort_if(!$request->user(), 403);
$pid = $request->user()->profile_id;
$home = $request->input('home.last_read_id');
$notifications = $request->input('notifications.last_read_id');
$home = $request->input('home[last_read_id]');
$notifications = $request->input('notifications[last_read_id]');
if($home) {
return $this->json(MarkerService::set($pid, 'home', $home));