Update ProfileController

This commit is contained in:
Daniel Supernault 2018-09-02 21:59:54 -06:00
parent 6086bce4e2
commit 9b501e9c59
No known key found for this signature in database
GPG Key ID: 0DEF1C662C9033F7
1 changed files with 9 additions and 9 deletions

View File

@ -50,12 +50,13 @@ class ProfileController extends Controller
$isBlocked = $this->blockedProfileCheck($user);
}
if ($isPrivate == true || $isBlocked == true) {
return view('profile.private', compact('user'));
}
$owner = $loggedIn && Auth::id() === $user->user_id;
$is_following = ($owner == false && Auth::check()) ? $user->followedBy(Auth::user()->profile) : false;
if ($isPrivate == true || $isBlocked == true) {
return view('profile.private', compact('user', 'is_following'));
}
$is_admin = is_null($user->domain) ? $user->user->is_admin : false;
$timeline = $user->statuses()
->whereHas('media')
@ -142,6 +143,8 @@ class ProfileController extends Controller
{
$profile = $user = Profile::whereUsername($username)->firstOrFail();
// TODO: fix $profile/$user mismatch in profile & follower templates
$owner = Auth::check() && Auth::id() === $user->user_id;
$is_following = ($owner == false && Auth::check()) ? $user->followedBy(Auth::user()->profile) : false;
if($profile->is_private || Auth::check()) {
$blocked = $this->blockedProfileCheck($profile);
$check = $this->privateProfileCheck($profile, null);
@ -149,8 +152,6 @@ class ProfileController extends Controller
return view('profile.private', compact('user'));
}
}
$owner = Auth::check() && Auth::id() === $user->user_id;
$is_following = ($owner == false && Auth::check()) ? $user->followedBy(Auth::user()->profile) : false;
$followers = $profile->followers()->orderBy('created_at', 'desc')->simplePaginate(12);
$is_admin = is_null($user->domain) ? $user->user->is_admin : false;
if ($user->remote_url) {
@ -166,6 +167,8 @@ class ProfileController extends Controller
{
$profile = $user = Profile::whereUsername($username)->firstOrFail();
// TODO: fix $profile/$user mismatch in profile & follower templates
$owner = Auth::check() && Auth::id() === $user->user_id;
$is_following = ($owner == false && Auth::check()) ? $user->followedBy(Auth::user()->profile) : false;
if($profile->is_private || Auth::check()) {
$blocked = $this->blockedProfileCheck($profile);
$check = $this->privateProfileCheck($profile, null);
@ -173,9 +176,6 @@ class ProfileController extends Controller
return view('profile.private', compact('user'));
}
}
$user = $profile;
$owner = Auth::check() && Auth::id() === $user->user_id;
$is_following = ($owner == false && Auth::check()) ? $user->followedBy(Auth::user()->profile) : false;
$following = $profile->following()->orderBy('created_at', 'desc')->simplePaginate(12);
$is_admin = is_null($user->domain) ? $user->user->is_admin : false;
if ($user->remote_url) {