diff --git a/app/Http/Controllers/PublicApiController.php b/app/Http/Controllers/PublicApiController.php index 3a268502..510b1571 100644 --- a/app/Http/Controllers/PublicApiController.php +++ b/app/Http/Controllers/PublicApiController.php @@ -395,8 +395,12 @@ class PublicApiController extends Controller public function accountFollowers(Request $request, $id) { - $profile = Profile::findOrFail($id); - $followers = $profile->followers; + abort_unless(Auth::check(), 403); + $profile = Profile::with('user')->whereNull('status')->whereNull('domain')->findOrFail($id); + if($profile->is_private || !$profile->user->settings->show_profile_followers) { + return []; + } + $followers = $profile->followers()->orderByDesc('followers.created_at')->paginate(10); $resource = new Fractal\Resource\Collection($followers, new AccountTransformer()); $res = $this->fractal->createData($resource)->toArray(); @@ -405,8 +409,12 @@ class PublicApiController extends Controller public function accountFollowing(Request $request, $id) { - $profile = Profile::findOrFail($id); - $following = $profile->following; + abort_unless(Auth::check(), 403); + $profile = Profile::with('user')->whereNull('status')->whereNull('domain')->findOrFail($id); + if($profile->is_private || !$profile->user->settings->show_profile_following) { + return []; + } + $following = $profile->following()->orderByDesc('followers.created_at')->paginate(10); $resource = new Fractal\Resource\Collection($following, new AccountTransformer()); $res = $this->fractal->createData($resource)->toArray(); @@ -468,4 +476,5 @@ class PublicApiController extends Controller return response()->json($res); } + } diff --git a/public/js/profile.js b/public/js/profile.js index 1bdcab3e..fad34bc1 100644 Binary files a/public/js/profile.js and b/public/js/profile.js differ diff --git a/public/mix-manifest.json b/public/mix-manifest.json index 521994be..90f81ac2 100644 Binary files a/public/mix-manifest.json and b/public/mix-manifest.json differ diff --git a/resources/assets/js/components/Profile.vue b/resources/assets/js/components/Profile.vue index 76c36a12..dddb4ef7 100644 --- a/resources/assets/js/components/Profile.vue +++ b/resources/assets/js/components/Profile.vue @@ -39,13 +39,13 @@
- + {{profile.followers_count}} Followers
- + {{profile.following_count}} Following @@ -223,6 +223,64 @@ + +
+
+
+ + + +
+

+ + {{user.username}} + +

+

+ {{user.display_name}} +

+
+
+
+
+

Load more

+
+
+
+ +
+
+
+ + + +
+

+ + {{user.username}} + +

+

+ {{user.display_name}} +

+
+
+
+
+

Load more

+
+
+