Skip to content

Commit

Permalink
#2657 Fixes for explore page causing crashes for certain dungeons.
Browse files Browse the repository at this point in the history
  • Loading branch information
Wotuu committed Jan 20, 2025
1 parent 22d9697 commit 57558bb
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions app/Http/Controllers/Dungeon/DungeonExploreController.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,16 @@ public function get(Request $request, CombatLogEventServiceInterface $combatLogE
]);
}

public function viewDungeon(Request $request, CombatLogEventServiceInterface $combatLogEventService, Dungeon $dungeon): RedirectResponse
public function viewDungeon(Request $request, Dungeon $dungeon): RedirectResponse
{
$dungeon->load(['currentMappingVersion']);

if (!$dungeon->active || $dungeon->currentMappingVersion === null) {
return redirect()->route('dungeon.explore.list');
}

$dungeon->load(['currentMappingVersion']);

/** @var Floor $defaultFloor */
$defaultFloor = Floor::where('dungeon_id', $dungeon->id)
->defaultOrFacade($dungeon->currentMappingVersion)
Expand All @@ -50,10 +56,15 @@ public function viewDungeonFloor(
Dungeon $dungeon,
string $floorIndex = '1'): View|RedirectResponse
{
$dungeon->load(['currentMappingVersion']);

if (!$dungeon->active || $dungeon->currentMappingVersion === null) {
return redirect()->route('dungeon.explore.list');
}

if (!is_numeric($floorIndex)) {
$floorIndex = '1';
}
$dungeon->load(['currentMappingVersion']);

/** @var Floor $floor */
$floor = Floor::where('dungeon_id', $dungeon->id)
Expand Down Expand Up @@ -87,7 +98,9 @@ public function viewDungeonFloor(

$mostRecentSeason = $dungeon->getActiveSeason($seasonService);

$heatmapActive = Feature::active(Heatmap::class) && $dungeon->gameVersion->has_seasons;
$heatmapActive = Feature::active(Heatmap::class) &&
$dungeon->gameVersion->has_seasons &&
$dungeon->challenge_mode_id !== null;

$dungeon->trackPageView();

Expand Down

0 comments on commit 57558bb

Please sign in to comment.