From 5e1295f18ba226ec2e9f1b55cdb7771e885dbadc Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 10 Sep 2019 22:38:15 -0600 Subject: [PATCH] Remove deprecated profile following/followers --- app/Http/Controllers/ProfileController.php | 60 ------------------- resources/views/profile/followers.blade.php | 66 --------------------- resources/views/profile/following.blade.php | 66 --------------------- routes/web.php | 2 - 4 files changed, 194 deletions(-) delete mode 100644 resources/views/profile/followers.blade.php delete mode 100644 resources/views/profile/following.blade.php diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php index 7ab41a28..cbc120ce 100644 --- a/app/Http/Controllers/ProfileController.php +++ b/app/Http/Controllers/ProfileController.php @@ -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); diff --git a/resources/views/profile/followers.blade.php b/resources/views/profile/followers.blade.php deleted file mode 100644 index aa6ef39a..00000000 --- a/resources/views/profile/followers.blade.php +++ /dev/null @@ -1,66 +0,0 @@ -@extends('layouts.app',['title' => $profile->username . "’s followers"]) - -@section('content') - -@include('profile.partial.user-info') - -
-
- @if($followers->count() !== 0) -
    - @foreach($followers as $user) -
  • - - - - - {{$user->username}} - - - {{$user->name}} - - @if(Auth::check() && Auth::id() != $user->user_id) - @if ($user->followedBy(Auth::user()->profile) == true) - - - - @else - - - - @endif - @endif -
  • - @endforeach -
- @else -
-
-
-
-

{{ __('profile.emptyFollowers') }}

-
-
-
-
- @endif -
- {{$followers->links()}} -
-
-
-@endsection - -@push('meta') - - - -@endpush diff --git a/resources/views/profile/following.blade.php b/resources/views/profile/following.blade.php deleted file mode 100644 index 623accf6..00000000 --- a/resources/views/profile/following.blade.php +++ /dev/null @@ -1,66 +0,0 @@ -@extends('layouts.app',['title' => $profile->username . "’s follows"]) - -@section('content') - -@include('profile.partial.user-info') - -
-
- @if($following->count() !== 0) -
    - @foreach($following as $user) -
  • - - - - - {{$user->username}} - - - {{$user->name}} - - @if(Auth::check() && Auth::id() != $user->user_id) - @if ($user->followedBy(Auth::user()->profile) == true) - - - - @else - - - - @endif - @endif -
  • - @endforeach -
- @else -
-
-
-
-

{{ __('profile.emptyFollowing') }}

-
-
-
-
- @endif -
- {{$following->links()}} -
-
-
-@endsection - -@push('meta') - - - -@endpush diff --git a/routes/web.php b/routes/web.php index 0dd1b37f..d4090361 100644 --- a/routes/web.php +++ b/routes/web.php @@ -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'); });