Update LikeService, show like count to status owner

This commit is contained in:
Daniel Supernault 2021-05-12 22:18:00 -06:00
parent f47161fcd9
commit 4408e2ef8c
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7
2 changed files with 9 additions and 2 deletions

View file

@ -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;
}
}

View file

@ -228,7 +228,7 @@
<span class="like-count">Liked by
<a class="font-weight-bold text-dark" :href="'/'+status.liked_by.username">{{status.liked_by.username}}</a>
<span v-if="status.liked_by.others == true">
and <span class="font-weight-bold">others</span>
and <span class="font-weight-bold" v-if="status.liked_by.total_count_pretty">{{status.liked_by.total_count_pretty}}</span> <span class="font-weight-bold">others</span>
</span>
</span>
</div>