mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 14:31:26 +00:00
Update LikeService, fix likedBy method
This commit is contained in:
parent
c10a94649c
commit
a5e64da69b
1 changed files with 20 additions and 6 deletions
|
@ -50,13 +50,27 @@ class LikeService {
|
|||
|
||||
public static function likedBy($status)
|
||||
{
|
||||
if(!$status->likes_count) {
|
||||
return [
|
||||
'username' => null,
|
||||
'others' => false
|
||||
];
|
||||
$empty = [
|
||||
'username' => null,
|
||||
'others' => false
|
||||
];
|
||||
|
||||
if(!$status) {
|
||||
return $empty;
|
||||
}
|
||||
$id = Like::whereStatusId($status->id)->first()->profile_id;
|
||||
|
||||
if(!$status->likes_count) {
|
||||
return $empty;
|
||||
}
|
||||
|
||||
$like = Like::whereStatusId($status->id)->first();
|
||||
|
||||
if(!$like) {
|
||||
return $empty;
|
||||
}
|
||||
|
||||
$id = $like->profile_id;
|
||||
|
||||
return [
|
||||
'username' => ProfileService::get($id)['username'],
|
||||
'others' => $status->likes_count >= 5,
|
||||
|
|
Loading…
Reference in a new issue