Update RemoteProfile component, add follower modals

This commit is contained in:
Daniel Supernault 2021-07-25 05:06:38 -06:00
parent 0e178a3371
commit c4146a3040
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7
2 changed files with 248 additions and 8 deletions

View file

@ -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 [];