From 4408e2ef8c3cd2980a74041fb787451648143c1c Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Wed, 12 May 2021 22:18:00 -0600 Subject: [PATCH] Update LikeService, show like count to status owner --- app/Services/LikeService.php | 9 ++++++++- resources/assets/js/components/Timeline.vue | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/Services/LikeService.php b/app/Services/LikeService.php index 36f31ee44..a1bdeb55f 100644 --- a/app/Services/LikeService.php +++ b/app/Services/LikeService.php @@ -71,9 +71,16 @@ class LikeService { $id = $like->profile_id; - return [ + $res = [ 'username' => ProfileService::get($id)['username'], 'others' => $status->likes_count >= 5, ]; + + if(request()->user()->profile_id == $status->profile_id) { + $res['total_count'] = $status->likes_count; + $res['total_count_pretty'] = number_format($res['total_count']); + } + + return $res; } } diff --git a/resources/assets/js/components/Timeline.vue b/resources/assets/js/components/Timeline.vue index ca5a3b8b5..fc7b387a0 100644 --- a/resources/assets/js/components/Timeline.vue +++ b/resources/assets/js/components/Timeline.vue @@ -228,7 +228,7 @@ Liked by {{status.liked_by.username}} - and others + and {{status.liked_by.total_count_pretty}} others