diff --git a/app/Http/Controllers/Api/ApiV1Controller.php b/app/Http/Controllers/Api/ApiV1Controller.php index cb2a31bb9..fbf6c4765 100644 --- a/app/Http/Controllers/Api/ApiV1Controller.php +++ b/app/Http/Controllers/Api/ApiV1Controller.php @@ -471,6 +471,7 @@ class ApiV1Controller extends Controller 'limit' => 'sometimes|integer|min:1|max:80' ]); $limit = $request->input('limit', 10); + $napi = $request->has(self::PF_API_ENTITY_KEY); if(intval($pid) !== intval($account['id'])) { if($account['locked']) { @@ -496,8 +497,8 @@ class ApiV1Controller extends Controller ->whereFollowingId($account['id']) ->orderByDesc('id') ->simplePaginate($limit) - ->map(function($follower) { - return AccountService::getMastodon($follower->profile_id, true); + ->map(function($follower) use($napi) { + return $napi ? AccountService::get($follower->profile_id, true) : AccountService::getMastodon($follower->profile_id, true); }) ->filter(function($account) { return $account && isset($account['id']); @@ -531,8 +532,8 @@ class ApiV1Controller extends Controller } } - $res = $paginator->map(function($follower) { - return AccountService::get($follower->profile_id, true); + $res = $paginator->map(function($follower) use($napi) { + return $napi ? AccountService::get($follower->profile_id, true) : AccountService::getMastodon($follower->profile_id, true); }) ->filter(function($account) { return $account && isset($account['id']); @@ -561,6 +562,7 @@ class ApiV1Controller extends Controller 'limit' => 'sometimes|integer|min:1|max:80' ]); $limit = $request->input('limit', 10); + $napi = $request->has(self::PF_API_ENTITY_KEY); if(intval($pid) !== intval($account['id'])) { if($account['locked']) { @@ -587,8 +589,8 @@ class ApiV1Controller extends Controller ->whereProfileId($account['id']) ->orderByDesc('id') ->simplePaginate($limit) - ->map(function($follower) { - return AccountService::get($follower->following_id, true); + ->map(function($follower) use($napi) { + return $napi ? AccountService::get($follower->following_id, true) : AccountService::getMastodon($follower->following_id, true); }) ->filter(function($account) { return $account && isset($account['id']); @@ -621,8 +623,8 @@ class ApiV1Controller extends Controller } } - $res = $paginator->map(function($follower) { - return AccountService::get($follower->following_id, true); + $res = $paginator->map(function($follower) use($napi) { + return $napi ? AccountService::get($follower->following_id, true) : AccountService::getMastodon($follower->following_id, true); }) ->filter(function($account) { return $account && isset($account['id']); diff --git a/resources/assets/components/partials/profile/ProfileFollowers.vue b/resources/assets/components/partials/profile/ProfileFollowers.vue index 572ba97ea..4f3df5fec 100644 --- a/resources/assets/components/partials/profile/ProfileFollowers.vue +++ b/resources/assets/components/partials/profile/ProfileFollowers.vue @@ -131,7 +131,8 @@ fetchFollowers() { axios.get('/api/v1/accounts/'+this.profile.id+'/followers', { params: { - cursor: this.cursor + cursor: this.cursor, + '_pe': 1 } }).then(res => { if(!res.data.length) { diff --git a/resources/assets/components/partials/profile/ProfileFollowing.vue b/resources/assets/components/partials/profile/ProfileFollowing.vue index ae226048c..a3334f3cc 100644 --- a/resources/assets/components/partials/profile/ProfileFollowing.vue +++ b/resources/assets/components/partials/profile/ProfileFollowing.vue @@ -129,7 +129,8 @@ fetchFollowers() { axios.get('/api/v1/accounts/'+this.profile.id+'/following', { params: { - cursor: this.cursor + cursor: this.cursor, + '_pe': 1 } }).then(res => { if(!res.data.length) { diff --git a/resources/assets/js/components/Profile.vue b/resources/assets/js/components/Profile.vue index 5558bae0b..160a3ea10 100644 --- a/resources/assets/js/components/Profile.vue +++ b/resources/assets/js/components/Profile.vue @@ -1084,7 +1084,8 @@ axios.get('/api/v1/accounts/'+this.profileId+'/following', { params: { cursor: this.followingCursor, - limit: 40 + limit: 40, + '_pe': 1 } }) .then(res => { @@ -1125,7 +1126,8 @@ axios.get('/api/v1/accounts/'+this.profileId+'/followers', { params: { cursor: this.followerCursor, - limit: 40 + limit: 40, + '_pe': 1 } }) .then(res => { @@ -1158,7 +1160,8 @@ axios.get('/api/v1/accounts/'+this.profile.id+'/following', { params: { cursor: this.followingCursor, - limit: 40 + limit: 40, + '_pe': 1 } }) .then(res => { @@ -1187,7 +1190,8 @@ axios.get('/api/v1/accounts/'+this.profile.id+'/followers', { params: { cursor: this.followerCursor, - limit: 40 + limit: 40, + '_pe': 1 } }) .then(res => {