diff --git a/app/Http/Controllers/PublicApiController.php b/app/Http/Controllers/PublicApiController.php index 707434661..afeffa125 100644 --- a/app/Http/Controllers/PublicApiController.php +++ b/app/Http/Controllers/PublicApiController.php @@ -199,8 +199,15 @@ class PublicApiController extends Controller public function statusLikes(Request $request, $username, $id) { + abort_if(!$request->user(), 404); $status = Status::findOrFail($id); $this->scopeCheck($status->profile, $status); + $page = $request->input('page'); + if($page && $page >= 3 && $request->user()->profile_id != $status->profile_id) { + return response()->json([ + 'data' => [] + ]); + } $likes = $this->getLikes($status); return response()->json([ 'data' => $likes @@ -209,9 +216,16 @@ class PublicApiController extends Controller public function statusShares(Request $request, $username, $id) { + abort_if(!$request->user(), 404); $profile = Profile::whereUsername($username)->whereNull('status')->firstOrFail(); $status = Status::whereProfileId($profile->id)->findOrFail($id); $this->scopeCheck($profile, $status); + $page = $request->input('page'); + if($page && $page >= 3 && $request->user()->profile_id != $status->profile_id) { + return response()->json([ + 'data' => [] + ]); + } $shares = $this->getShares($status); return response()->json([ 'data' => $shares diff --git a/app/Services/LikeService.php b/app/Services/LikeService.php index cb41850e1..063266642 100644 --- a/app/Services/LikeService.php +++ b/app/Services/LikeService.php @@ -71,13 +71,16 @@ class LikeService { $id = $like->profile_id; + $profile = ProfileService::get($id); + $profileUrl = $profile['local'] ? $profile['url'] : '/i/web/profile/_/' . $profile['id']; $res = [ - 'username' => ProfileService::get($id)['username'], - 'others' => $status->likes_count >= 5, + 'username' => $profile['username'], + 'url' => $profileUrl, + 'others' => $status->likes_count >= 3, ]; if(request()->user() && request()->user()->profile_id == $status->profile_id) { - $res['total_count'] = $status->likes_count; + $res['total_count'] = ($status->likes_count - 1); $res['total_count_pretty'] = number_format($res['total_count']); } diff --git a/resources/assets/js/components/PostComponent.vue b/resources/assets/js/components/PostComponent.vue index 61762bac7..3c8076031 100644 --- a/resources/assets/js/components/PostComponent.vue +++ b/resources/assets/js/components/PostComponent.vue @@ -223,7 +223,7 @@