Skip to content

Commit

Permalink
refactor(browse): compact character/myo visibility checks
Browse files Browse the repository at this point in the history
  • Loading branch information
itinerare committed Sep 3, 2024
1 parent 3d92eb4 commit 4da7dae
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions app/Http/Controllers/BrowseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -334,9 +334,7 @@ public function getCharacters(Request $request) {
break;
}

if (!Auth::check() || !Auth::user()->hasPower('manage_characters')) {
$query->visible();
}
$query->visible(Auth::user() ?? null);

return view('browse.masterlist', [
'isMyo' => false,
Expand Down Expand Up @@ -465,9 +463,7 @@ public function getMyos(Request $request) {
break;
}

if (!Auth::check() || !Auth::user()->hasPower('manage_characters')) {
$query->visible();
}
$query->visible(Auth::user() ?? null);

return view('browse.myo_masterlist', [
'isMyo' => true,
Expand Down Expand Up @@ -676,9 +672,7 @@ public function getSublist(Request $request, $key) {
break;
}

if (!Auth::check() || !Auth::user()->hasPower('manage_characters')) {
$query->visible();
}
$query->visible(Auth::user() ?? null);

$subCategory = CharacterCategory::where('masterlist_sub_id', $sublist->id)->orderBy('character_categories.sort', 'DESC')->pluck('name', 'id')->toArray();
if (!$subCategory) {
Expand Down

0 comments on commit 4da7dae

Please sign in to comment.