mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-30 10:13:16 +00:00
Merge pull request #434 from pixelfed/frontend-ui-refactor
Update ProfileController
This commit is contained in:
commit
9c1b714342
1 changed files with 24 additions and 3 deletions
|
@ -86,7 +86,7 @@ class ProfileController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = Auth::user()->profile;
|
$user = Auth::user()->profile;
|
||||||
if($user->id == $profile->id) {
|
if($user->id == $profile->id || !$profile->is_private) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,7 +124,14 @@ class ProfileController extends Controller
|
||||||
|
|
||||||
public function showAtomFeed(Request $request, $user)
|
public function showAtomFeed(Request $request, $user)
|
||||||
{
|
{
|
||||||
$profile = Profile::whereUsername($user)->firstOrFail();
|
$profile = $user = Profile::whereUsername($user)->firstOrFail();
|
||||||
|
if($profile->is_private || Auth::check()) {
|
||||||
|
$blocked = $this->blockedProfileCheck($profile);
|
||||||
|
$check = $this->privateProfileCheck($profile, null);
|
||||||
|
if($check || $blocked) {
|
||||||
|
return view('profile.private', compact('user'));
|
||||||
|
}
|
||||||
|
}
|
||||||
$items = $profile->statuses()->orderBy('created_at', 'desc')->take(10)->get();
|
$items = $profile->statuses()->orderBy('created_at', 'desc')->take(10)->get();
|
||||||
return response()->view('atom.user', compact('profile', 'items'))
|
return response()->view('atom.user', compact('profile', 'items'))
|
||||||
->header('Content-Type', 'application/atom+xml');
|
->header('Content-Type', 'application/atom+xml');
|
||||||
|
@ -134,6 +141,13 @@ class ProfileController extends Controller
|
||||||
{
|
{
|
||||||
$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
|
||||||
|
if($profile->is_private || Auth::check()) {
|
||||||
|
$blocked = $this->blockedProfileCheck($profile);
|
||||||
|
$check = $this->privateProfileCheck($profile, null);
|
||||||
|
if($check || $blocked) {
|
||||||
|
return view('profile.private', compact('user'));
|
||||||
|
}
|
||||||
|
}
|
||||||
$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;
|
||||||
$followers = $profile->followers()->orderBy('created_at', 'desc')->simplePaginate(12);
|
$followers = $profile->followers()->orderBy('created_at', 'desc')->simplePaginate(12);
|
||||||
|
@ -149,8 +163,15 @@ class ProfileController extends Controller
|
||||||
|
|
||||||
public function following(Request $request, $username)
|
public function following(Request $request, $username)
|
||||||
{
|
{
|
||||||
$profile = 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
|
||||||
|
if($profile->is_private || Auth::check()) {
|
||||||
|
$blocked = $this->blockedProfileCheck($profile);
|
||||||
|
$check = $this->privateProfileCheck($profile, null);
|
||||||
|
if($check || $blocked) {
|
||||||
|
return view('profile.private', compact('user'));
|
||||||
|
}
|
||||||
|
}
|
||||||
$user = $profile;
|
$user = $profile;
|
||||||
$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;
|
||||||
|
|
Loading…
Reference in a new issue