mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-27 00:33:17 +00:00
Merge pull request #431 from pixelfed/frontend-ui-refactor
Frontend ui refactor
This commit is contained in:
commit
53b70fae45
2 changed files with 30 additions and 24 deletions
|
@ -42,16 +42,17 @@ class ProfileController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user->is_private == true) {
|
if ($user->is_private == true) {
|
||||||
$isPrivate = $this->privateProfileCheck($user);
|
$isPrivate = $this->privateProfileCheck($user, $loggedIn);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($loggedIn == true) {
|
if ($loggedIn == true) {
|
||||||
$isPrivate = $this->blockedProfileCheck($user);
|
$isBlocked = $this->blockedProfileCheck($user);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($isPrivate == true) {
|
if ($isPrivate == true || $isBlocked == true) {
|
||||||
return view('profile.private', compact('user'));
|
return view('profile.private', compact('user'));
|
||||||
} else {
|
}
|
||||||
|
|
||||||
$owner = $loggedIn && Auth::id() === $user->user_id;
|
$owner = $loggedIn && 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;
|
||||||
$is_admin = is_null($user->domain) ? $user->user->is_admin : false;
|
$is_admin = is_null($user->domain) ? $user->user->is_admin : false;
|
||||||
|
@ -62,7 +63,6 @@ class ProfileController extends Controller
|
||||||
->orderBy('created_at', 'desc')
|
->orderBy('created_at', 'desc')
|
||||||
->withCount(['comments', 'likes'])
|
->withCount(['comments', 'likes'])
|
||||||
->simplePaginate(21);
|
->simplePaginate(21);
|
||||||
}
|
|
||||||
|
|
||||||
return view('profile.show', compact('user', 'settings', 'owner', 'is_following', 'is_admin', 'timeline'));
|
return view('profile.show', compact('user', 'settings', 'owner', 'is_following', 'is_admin', 'timeline'));
|
||||||
}
|
}
|
||||||
|
@ -79,20 +79,26 @@ class ProfileController extends Controller
|
||||||
return redirect($user->url());
|
return redirect($user->url());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function privateProfileCheck(Profile $profile)
|
protected function privateProfileCheck(Profile $profile, $loggedIn)
|
||||||
{
|
{
|
||||||
if (Auth::check() === false) {
|
if (!Auth::check()) {
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
$pid = Auth::user()->profile->id;
|
|
||||||
$follower_ids = $profile->followers()->pluck('followers.profile_id')->toArray();
|
$user = Auth::user()->profile;
|
||||||
if (!in_array($pid, $follower_ids) && $pid !== $profile->id) {
|
if($user->id == $profile->id) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$follows = Follower::whereProfileId($user->id)->whereFollowingId($profile->id)->exists();
|
||||||
|
if ($follows == false) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
protected function blockedProfileCheck(Profile $profile)
|
protected function blockedProfileCheck(Profile $profile)
|
||||||
{
|
{
|
||||||
$pid = Auth::user()->profile->id;
|
$pid = Auth::user()->profile->id;
|
||||||
|
|
|
@ -8,11 +8,11 @@
|
||||||
<div class="profile-timeline mt-2 mt-md-4">
|
<div class="profile-timeline mt-2 mt-md-4">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body py-5">
|
<div class="card-body py-5">
|
||||||
<p class="text-center lead font-weight-bold">
|
<p class="text-center lead font-weight-bold mb-0">
|
||||||
{{__('profile.privateProfileWarning')}}
|
{{__('profile.privateProfileWarning')}}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@if(Auth::check())
|
@if(!Auth::check())
|
||||||
<p class="text-center mb-0">{{ __('profile.alreadyFollow', ['username'=>$user->username])}}</p>
|
<p class="text-center mb-0">{{ __('profile.alreadyFollow', ['username'=>$user->username])}}</p>
|
||||||
<p class="text-center mb-0"><a href="{{route('login')}}">{{__('Log in')}}</a></p>
|
<p class="text-center mb-0"><a href="{{route('login')}}">{{__('Log in')}}</a></p>
|
||||||
<p class="text-center mb-0">{{__('profile.loginToSeeProfile')}}</p>
|
<p class="text-center mb-0">{{__('profile.loginToSeeProfile')}}</p>
|
||||||
|
|
Loading…
Reference in a new issue