mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-25 15:55:22 +00:00
Update PublicApiController, add bookmark state to timeline endpoints
This commit is contained in:
parent
34a3d65f30
commit
c0b1e0427e
1 changed files with 5 additions and 0 deletions
|
@ -27,6 +27,7 @@ use App\Transformer\Api\{
|
|||
};
|
||||
use App\Services\{
|
||||
AccountService,
|
||||
BookmarkService,
|
||||
FollowerService,
|
||||
LikeService,
|
||||
PublicTimelineService,
|
||||
|
@ -327,6 +328,7 @@ class PublicApiController extends Controller
|
|||
return false;
|
||||
}
|
||||
$status['favourited'] = (bool) LikeService::liked($user->profile_id, $s->id);
|
||||
$status['bookmarked'] = (bool) BookmarkService::get($user->profile_id, $s->id);
|
||||
return $status;
|
||||
})
|
||||
->filter(function($s) use($filtered) {
|
||||
|
@ -369,6 +371,7 @@ class PublicApiController extends Controller
|
|||
return false;
|
||||
}
|
||||
$status['favourited'] = (bool) LikeService::liked($user->profile_id, $s->id);
|
||||
$status['bookmarked'] = (bool) BookmarkService::get($user->profile_id, $s->id);
|
||||
return $status;
|
||||
})
|
||||
->filter(function($s) use($filtered) {
|
||||
|
@ -398,6 +401,8 @@ class PublicApiController extends Controller
|
|||
$status = StatusService::get($k);
|
||||
if($user) {
|
||||
$status['favourited'] = (bool) LikeService::liked($user->profile_id, $k);
|
||||
$status['bookmarked'] = (bool) BookmarkService::get($user->profile_id, $k);
|
||||
|
||||
$status['relationship'] = RelationshipService::get($user->profile_id, $status['account']['id']);
|
||||
}
|
||||
return $status;
|
||||
|
|
Loading…
Reference in a new issue