mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-25 15:55:22 +00:00
Update PublicApiController, add LikeService to Network timeline
This commit is contained in:
parent
d3157f2a2d
commit
82895591c3
1 changed files with 12 additions and 7 deletions
|
@ -26,6 +26,7 @@ use App\Transformer\Api\{
|
|||
};
|
||||
use App\Services\{
|
||||
AccountService,
|
||||
LikeService,
|
||||
PublicTimelineService,
|
||||
StatusService,
|
||||
SnowflakeService,
|
||||
|
@ -527,8 +528,10 @@ class PublicApiController extends Controller
|
|||
->orderBy('created_at', 'desc')
|
||||
->limit($limit)
|
||||
->get()
|
||||
->map(function($s) {
|
||||
return StatusService::get($s->id);
|
||||
->map(function($s) use ($user) {
|
||||
$status = StatusService::get($s->id);
|
||||
$status['favourited'] = (bool) LikeService::liked($user->profile_id, $s->id);
|
||||
return $status;
|
||||
});
|
||||
$res = $timeline->toArray();
|
||||
} else {
|
||||
|
@ -545,8 +548,10 @@ class PublicApiController extends Controller
|
|||
->orderBy('created_at', 'desc')
|
||||
->limit($limit)
|
||||
->get()
|
||||
->map(function($s) {
|
||||
return StatusService::get($s->id);
|
||||
->map(function($s) use ($user) {
|
||||
$status = StatusService::get($s->id);
|
||||
$status['favourited'] = (bool) LikeService::liked($user->profile_id, $s->id);
|
||||
return $status;
|
||||
});
|
||||
$res = $timeline->toArray();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue