diff --git a/app/Http/Controllers/PublicApiController.php b/app/Http/Controllers/PublicApiController.php index 24b4ff740..fdfae931c 100644 --- a/app/Http/Controllers/PublicApiController.php +++ b/app/Http/Controllers/PublicApiController.php @@ -591,11 +591,14 @@ class PublicApiController extends Controller public function accountFollowers(Request $request, $id) { abort_unless(Auth::check(), 403); - $profile = Profile::with('user')->whereNull('status')->whereNull('domain')->findOrFail($id); + $profile = Profile::with('user')->whereNull('status')->findOrFail($id); $owner = Auth::id() == $profile->user_id; - if(Auth::id() != $profile->user_id && $profile->is_private || !$profile->user->settings->show_profile_followers) { + if(Auth::id() != $profile->user_id && $profile->is_private) { return response()->json([]); } + if(!$profile->domain && !$profile->user->settings->show_profile_followers) { + return response()->json([]); + } if(!$owner && $request->page > 5) { return []; } @@ -612,7 +615,6 @@ class PublicApiController extends Controller $profile = Profile::with('user') ->whereNull('status') - ->whereNull('domain') ->findOrFail($id); // filter by username @@ -621,7 +623,10 @@ class PublicApiController extends Controller $filter = ($owner == true) && ($search != null); abort_if($owner == false && $profile->is_private == true && !$profile->followedBy(Auth::user()->profile), 404); - abort_if($profile->user->settings->show_profile_following == false && $owner == false, 404); + + if(!$profile->domain) { + abort_if($profile->user->settings->show_profile_following == false && $owner == false, 404); + } if(!$owner && $request->page > 5) { return []; diff --git a/resources/assets/js/components/RemoteProfile.vue b/resources/assets/js/components/RemoteProfile.vue index a281ced4e..28791c5a2 100644 --- a/resources/assets/js/components/RemoteProfile.vue +++ b/resources/assets/js/components/RemoteProfile.vue @@ -44,11 +44,11 @@ {{profile.statuses_count}} Posts - + {{profile.following_count}} Following - + {{profile.followers_count}} Followers @@ -90,6 +90,116 @@ + + +
+
+

+ {{profileUsername}} is not following yet

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

+ + {{user.username}} + +

+

+ {{user.acct.split('@')[0]}}@{{user.acct.split('@')[1]}} +

+

+ {{user.display_name ? user.display_name : user.username}} +

+
+
+ Following +
+
+
+
+
+

No Results Found

+
+
+
+

Load more

+
+
+
+
+
+ Loading... +
+
+
+ +
+
+

+ {{profileUsername}} has no followers yet

+
+ +
+
+
+ + + +
+

+ + {{user.username}} + +

+

+ {{user.acct.split('@')[0]}}@{{user.acct.split('@')[1]}} +

+

+ {{user.display_name ? user.display_name : user.username}} +

+
+ +
+
+
+

Load more

+
+
+
+
+
+ Loading... +
+
+
1) { + this.$refs.followingModal.show(); + return; + } else { + axios.get('/api/pixelfed/v1/accounts/'+this.profileId+'/following', { + params: { + page: this.followingCursor + } + }) + .then(res => { + this.following = res.data; + this.followingModalSearchCache = res.data; + this.followingCursor++; + if(res.data.length < 10) { + this.followingMore = false; + } + this.followingLoading = false; + }); + this.$refs.followingModal.show(); + return; + } + }, + + followersModal() { + if(this.followerCursor > 1) { + this.$refs.followerModal.show(); + return; + } else { + axios.get('/api/pixelfed/v1/accounts/'+this.profileId+'/followers', { + params: { + page: this.followerCursor + } + }) + .then(res => { + this.followers.push(...res.data); + this.followerCursor++; + if(res.data.length < 10) { + this.followerMore = false; + } + this.followerLoading = false; + }) + this.$refs.followerModal.show(); + return; + } + }, + + followingLoadMore() { + axios.get('/api/pixelfed/v1/accounts/'+this.profile.id+'/following', { + params: { + page: this.followingCursor, + fbu: this.followingModalSearch + } + }) + .then(res => { + if(res.data.length > 0) { + this.following.push(...res.data); + this.followingCursor++; + this.followingModalSearchCache = this.following; + } + if(res.data.length < 10) { + this.followingModalSearchCache = this.following; + this.followingMore = false; + } + }); + }, + + followersLoadMore() { + axios.get('/api/pixelfed/v1/accounts/'+this.profile.id+'/followers', { + params: { + page: this.followerCursor + } + }) + .then(res => { + if(res.data.length > 0) { + this.followers.push(...res.data); + this.followerCursor++; + } + if(res.data.length < 10) { + this.followerMore = false; + } + }); + }, + + profileUrlRedirect(profile) { + if(profile.local == true) { + return profile.url; + } + + return '/i/web/profile/_/' + profile.id; + }, + + followingModalSearchHandler() { + let self = this; + let q = this.followingModalSearch; + + if(q.length == 0) { + this.following = this.followingModalSearchCache; + this.followingModalSearch = null; + } + if(q.length > 0) { + let url = '/api/pixelfed/v1/accounts/' + + self.profileId + '/following?page=1&fbu=' + + q; + + axios.get(url).then(res => { + this.following = res.data; + }).catch(err => { + self.following = self.followingModalSearchCache; + self.followingModalSearch = null; + }); + } + }, } }