mirror of
https://github.com/pixelfed/pixelfed.git
synced 2025-01-30 16:30:45 +00:00
Update ProfileController
This commit is contained in:
parent
95799c5c70
commit
1aa8354f5a
1 changed files with 10 additions and 4 deletions
|
@ -37,7 +37,7 @@ class ProfileController extends Controller
|
||||||
$settings->show_profile_follower_count = true;
|
$settings->show_profile_follower_count = true;
|
||||||
$settings->show_profile_following_count = true;
|
$settings->show_profile_following_count = true;
|
||||||
} else {
|
} else {
|
||||||
$settings = User::whereUsername($username)->firstOrFail()->settings;
|
$settings = $user->user->settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($request->wantsJson() && config('pixelfed.activitypub_enabled')) {
|
if ($request->wantsJson() && config('pixelfed.activitypub_enabled')) {
|
||||||
|
@ -101,7 +101,6 @@ class ProfileController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function blockedProfileCheck(Profile $profile)
|
protected function blockedProfileCheck(Profile $profile)
|
||||||
|
@ -145,6 +144,7 @@ class ProfileController extends Controller
|
||||||
public function followers(Request $request, $username)
|
public function followers(Request $request, $username)
|
||||||
{
|
{
|
||||||
$profile = $user = Profile::whereUsername($username)->firstOrFail();
|
$profile = $user = Profile::whereUsername($username)->firstOrFail();
|
||||||
|
|
||||||
// TODO: fix $profile/$user mismatch in profile & follower templates
|
// TODO: fix $profile/$user mismatch in profile & follower templates
|
||||||
$owner = Auth::check() && Auth::id() === $user->user_id;
|
$owner = Auth::check() && Auth::id() === $user->user_id;
|
||||||
$is_following = ($owner == false && Auth::check()) ? $user->followedBy(Auth::user()->profile) : false;
|
$is_following = ($owner == false && Auth::check()) ? $user->followedBy(Auth::user()->profile) : false;
|
||||||
|
@ -161,7 +161,10 @@ class ProfileController extends Controller
|
||||||
$settings = new \StdClass;
|
$settings = new \StdClass;
|
||||||
$settings->crawlable = false;
|
$settings->crawlable = false;
|
||||||
} else {
|
} else {
|
||||||
$settings = User::whereUsername($username)->firstOrFail()->settings;
|
$settings = $profile->user->settings;
|
||||||
|
if(!$settings->show_profile_follower_count && !$owner) {
|
||||||
|
abort(403);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return view('profile.followers', compact('user', 'profile', 'followers', 'owner', 'is_following', 'is_admin', 'settings'));
|
return view('profile.followers', compact('user', 'profile', 'followers', 'owner', 'is_following', 'is_admin', 'settings'));
|
||||||
}
|
}
|
||||||
|
@ -185,7 +188,10 @@ class ProfileController extends Controller
|
||||||
$settings = new \StdClass;
|
$settings = new \StdClass;
|
||||||
$settings->crawlable = false;
|
$settings->crawlable = false;
|
||||||
} else {
|
} else {
|
||||||
$settings = User::whereUsername($username)->firstOrFail()->settings;
|
$settings = $profile->user->settings;
|
||||||
|
if(!$settings->show_profile_follower_count && !$owner) {
|
||||||
|
abort(403);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return view('profile.following', compact('user', 'profile', 'following', 'owner', 'is_following', 'is_admin', 'settings'));
|
return view('profile.following', compact('user', 'profile', 'following', 'owner', 'is_following', 'is_admin', 'settings'));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue