mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-25 06:23:18 +00:00
Merge pull request #2747 from pixelfed/staging
Update LikeService, fix likedBy method
This commit is contained in:
commit
4ad3de3b88
2 changed files with 21 additions and 6 deletions
|
@ -82,6 +82,7 @@
|
||||||
- Updated StatusTransformers, add liked_by attribute. ([372bacb0](https://github.com/pixelfed/pixelfed/commit/372bacb0))
|
- Updated StatusTransformers, add liked_by attribute. ([372bacb0](https://github.com/pixelfed/pixelfed/commit/372bacb0))
|
||||||
- Updated PostComponent, change like logic. ([0a35f5d6](https://github.com/pixelfed/pixelfed/commit/0a35f5d6))
|
- Updated PostComponent, change like logic. ([0a35f5d6](https://github.com/pixelfed/pixelfed/commit/0a35f5d6))
|
||||||
- Updated Timeline component, change like logic. ([7bcbf96b](https://github.com/pixelfed/pixelfed/commit/7bcbf96b))
|
- Updated Timeline component, change like logic. ([7bcbf96b](https://github.com/pixelfed/pixelfed/commit/7bcbf96b))
|
||||||
|
- Updated LikeService, fix likedBy method. ([a5e64da6](https://github.com/pixelfed/pixelfed/commit/a5e64da6))
|
||||||
- ([](https://github.com/pixelfed/pixelfed/commit/))
|
- ([](https://github.com/pixelfed/pixelfed/commit/))
|
||||||
|
|
||||||
## [v0.10.10 (2021-01-28)](https://github.com/pixelfed/pixelfed/compare/v0.10.9...v0.10.10)
|
## [v0.10.10 (2021-01-28)](https://github.com/pixelfed/pixelfed/compare/v0.10.9...v0.10.10)
|
||||||
|
|
|
@ -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