浏览代码

Update PublicApiController

Daniel Supernault 6 年之前
父节点
当前提交
292e6e18b1
共有 1 个文件被更改,包括 4 次插入4 次删除
  1. 4 4
      app/Http/Controllers/PublicApiController.php

+ 4 - 4
app/Http/Controllers/PublicApiController.php

@@ -528,8 +528,8 @@ class PublicApiController extends Controller
     {
         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 [];
+        if($profile->is_private || !$profile->user->settings->show_profile_followers && Auth::id() != $profile->user_id) {
+            return response()->json([]);
         }
         $followers = $profile->followers()->orderByDesc('followers.created_at')->paginate(10);
         $resource = new Fractal\Resource\Collection($followers, new AccountTransformer());
@@ -542,8 +542,8 @@ class PublicApiController extends Controller
     {
         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 [];
+        if($profile->is_private || !$profile->user->settings->show_profile_following && Auth::id() != $profile->user_id) {
+            return response()->json([]);
         }
         $following = $profile->following()->orderByDesc('followers.created_at')->paginate(10);
         $resource = new Fractal\Resource\Collection($following, new AccountTransformer());