Fixes For GDPR/Deleted Users (#1164)
* Fix DeletedUsers being displayed at Homepage Deleted users should not be displayed at homepage / newest pilots list. PR fixes that problem. * Do Not Display Deleted Users with LatestPireps As the main page, Latest Pilots widget should not display GDPR/Soft deleted users too. * StyleFix
This commit is contained in:
parent
ec6cb42bfd
commit
5094375e13
@ -3,6 +3,7 @@
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Contracts\Controller;
|
||||
use App\Models\Enums\UserState;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
@ -15,7 +16,7 @@ class HomeController extends Controller
|
||||
public function index()
|
||||
{
|
||||
try {
|
||||
$users = User::orderBy('created_at', 'desc')->take(4)->get();
|
||||
$users = User::where('state', '!=', UserState::DELETED)->orderBy('created_at', 'desc')->take(4)->get();
|
||||
} catch (\PDOException $e) {
|
||||
Log::emergency($e);
|
||||
return view('system/errors/database_error', [
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace App\Widgets;
|
||||
|
||||
use App\Contracts\Widget;
|
||||
use App\Models\Enums\UserState;
|
||||
use App\Repositories\UserRepository;
|
||||
|
||||
/**
|
||||
@ -20,10 +21,11 @@ class LatestPilots extends Widget
|
||||
public function run()
|
||||
{
|
||||
$userRepo = app(UserRepository::class);
|
||||
$userRepo = $userRepo->where('state', '!=', UserState::DELETED)->orderby('created_at', 'desc')->take($this->config['count'])->get();
|
||||
|
||||
return view('widgets.latest_pilots', [
|
||||
'config' => $this->config,
|
||||
'users' => $userRepo->with(['airline'])->recent($this->config['count']),
|
||||
'users' => $userRepo,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user