1
0
Fork 0
forked from mirror/pixelfed

Merge pull request #1697 from pixelfed/staging

Remove deprecated profile following/followers
This commit is contained in:
daniel 2019-09-10 22:39:26 -06:00 committed by GitHub
commit 63a9138455
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 0 additions and 194 deletions

View file

@ -186,66 +186,6 @@ class ProfileController extends Controller
->header('Content-Type', 'application/atom+xml');
}
public function followers(Request $request, $username)
{
$profile = $user = Profile::whereUsername($username)->firstOrFail();
if($profile->status != null) {
return $this->accountCheck($profile);
}
// 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);
if($check || $blocked) {
return view('profile.private', compact('user', 'is_following'));
}
}
$followers = $profile->followers()->whereNull('status')->orderBy('followers.created_at', 'desc')->simplePaginate(12);
$is_admin = is_null($user->domain) ? $user->user->is_admin : false;
if ($user->remote_url) {
$settings = new \StdClass;
$settings->crawlable = false;
} else {
$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'));
}
public function following(Request $request, $username)
{
$profile = $user = Profile::whereUsername($username)->firstOrFail();
if($profile->status != null) {
return $this->accountCheck($profile);
}
// 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);
if($check || $blocked) {
return view('profile.private', compact('user', 'is_following'));
}
}
$following = $profile->following()->whereNull('status')->orderBy('followers.created_at', 'desc')->simplePaginate(12);
$is_admin = is_null($user->domain) ? $user->user->is_admin : false;
if ($user->remote_url) {
$settings = new \StdClass;
$settings->crawlable = false;
} else {
$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'));
}
public function meRedirect()
{
abort_if(!Auth::check(), 404);

View file

@ -1,66 +0,0 @@
@extends('layouts.app',['title' => $profile->username . "s followers"])
@section('content')
@include('profile.partial.user-info')
<div class="container following-page" style="min-height: 60vh;">
<div class="col-12 col-md-8 offset-md-2 px-0">
@if($followers->count() !== 0)
<ul class="list-group mt-4 px-0">
@foreach($followers as $user)
<li class="list-group-item following card-md-rounded-0">
<span class="following-icon pr-3">
<img src="{{$user->avatarUrl()}}" width="32px" class="rounded-circle">
</span>
<a class="following-username font-weight-bold text-dark" href="{{$user->url()}}">
{{$user->username}}
</a>
<span class="following-name text-muted">
{{$user->name}}
</span>
@if(Auth::check() && Auth::id() != $user->user_id)
@if ($user->followedBy(Auth::user()->profile) == true)
<span class="float-right notification-action">
<form class="follow-form" method="post" action="/i/follow" style="display: inline;" data-id="{{$user->id}}" data-action="unfollow">
@csrf
<input type="hidden" name="item" value="{{$user->id}}">
<button class="btn btn-outline-secondary font-weight-bold px-4 py-0" type="submit">Unfollow</button>
</form>
</span>
@else
<span class="float-right notification-action">
<form class="follow-form" method="post" action="/i/follow" style="display: inline;" data-id="{{$user->id}}" data-action="follow">
@csrf
<input type="hidden" name="item" value="{{$user->id}}">
<button class="btn btn-primary font-weight-bold px-4 py-0" type="submit">Follow</button>
</form>
</span>
@endif
@endif
</li>
@endforeach
</ul>
@else
<div class="col-12">
<div class="card">
<div class="card-body py-5 my-5">
<div class="d-flex my-5 py-5 justify-content-center align-items-center">
<p class="lead font-weight-bold">{{ __('profile.emptyFollowers') }}</p>
</div>
</div>
</div>
</div>
@endif
<div class="d-flex justify-content-center mt-4">
{{$followers->links()}}
</div>
</div>
</div>
@endsection
@push('meta')
<meta property="og:description" content="{{$profile->bio}}">
<meta property="og:image" content="{{$profile->avatarUrl()}}">
<meta name="robots" content="NOINDEX, NOFOLLOW">
@endpush

View file

@ -1,66 +0,0 @@
@extends('layouts.app',['title' => $profile->username . "s follows"])
@section('content')
@include('profile.partial.user-info')
<div class="container following-page" style="min-height: 60vh;">
<div class="col-12 col-md-8 offset-md-2 px-0">
@if($following->count() !== 0)
<ul class="list-group mt-4 px-0">
@foreach($following as $user)
<li class="list-group-item following card-md-rounded-0">
<span class="following-icon pr-3">
<img src="{{$user->avatarUrl()}}" width="32px" class="rounded-circle">
</span>
<a class="following-username font-weight-bold text-dark" href="{{$user->url()}}">
{{$user->username}}
</a>
<span class="following-name text-muted">
{{$user->name}}
</span>
@if(Auth::check() && Auth::id() != $user->user_id)
@if ($user->followedBy(Auth::user()->profile) == true)
<span class="float-right notification-action">
<form class="follow-form" method="post" action="/i/follow" style="display: inline;" data-id="{{$user->id}}" data-action="unfollow">
@csrf
<input type="hidden" name="item" value="{{$user->id}}">
<button class="btn btn-outline-secondary font-weight-bold px-4 py-0" type="submit">Unfollow</button>
</form>
</span>
@else
<span class="float-right notification-action">
<form class="follow-form" method="post" action="/i/follow" style="display: inline;" data-id="{{$user->id}}" data-action="follow">
@csrf
<input type="hidden" name="item" value="{{$user->id}}">
<button class="btn btn-primary font-weight-bold px-4 py-0" type="submit">Follow</button>
</form>
</span>
@endif
@endif
</li>
@endforeach
</ul>
@else
<div class="col-12">
<div class="card">
<div class="card-body py-5 my-5">
<div class="d-flex my-5 py-5 justify-content-center align-items-center">
<p class="lead font-weight-bold">{{ __('profile.emptyFollowing') }}</p>
</div>
</div>
</div>
</div>
@endif
<div class="d-flex justify-content-center mt-4">
{{$following->links()}}
</div>
</div>
</div>
@endsection
@push('meta')
<meta property="og:description" content="{{$profile->bio}}">
<meta property="og:image" content="{{$profile->avatarUrl()}}">
<meta name="robots" content="NOINDEX, NOFOLLOW">
@endpush

View file

@ -341,7 +341,5 @@ Route::domain(config('pixelfed.domain.app'))->middleware(['validemail', 'twofact
Route::post('p/{username}/{id}/edit', 'StatusController@editStore');
Route::get('p/{username}/{id}.json', 'StatusController@showObject');
Route::get('p/{username}/{id}', 'StatusController@show');
Route::get('{username}/followers', 'ProfileController@followers')->middleware('auth');
Route::get('{username}/following', 'ProfileController@following')->middleware('auth');
Route::get('{username}', 'ProfileController@show');
});