forked from mirror/pixelfed
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)
|
public static function likedBy($status)
|
||||||
{
|
{
|
||||||
if(!$status->likes_count) {
|
$empty = [
|
||||||
return [
|
'username' => null,
|
||||||
'username' => null,
|
'others' => false
|
||||||
'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 [
|
return [
|
||||||
'username' => ProfileService::get($id)['username'],
|
'username' => ProfileService::get($id)['username'],
|
||||||
'others' => $status->likes_count >= 5,
|
'others' => $status->likes_count >= 5,
|
||||||
|
|
Loading…
Reference in a new issue