Skip to content

Commit

Permalink
Remove unnecessary request override of look&feel in LookAndFeelServic…
Browse files Browse the repository at this point in the history
…eProvider
  • Loading branch information
danon committed Dec 16, 2024
1 parent 1e74d40 commit 7356242
Showing 1 changed file with 2 additions and 20 deletions.
22 changes: 2 additions & 20 deletions app/Feature/LookAndFeel/LookAndFeelServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function boot(): void

Route::middleware(['web', 'auth'])->group(function () {
Route::get('/LookAndFeel/StyleGuide', function (StyleGuide $guide, StyleGuideView $view) {
if ($this->userSetting() === 'modern') {
if ($this->lookAndFeel() === 'modern') {
return $view->view($guide->getPrimitiveColorGroups());
}
return response(status:404);
Expand All @@ -36,12 +36,7 @@ public function boot(): void
});
}

private function lookAndFeel(): string
{
return $this->requestOverride() ?? $this->userSetting() ?? 'legacy';
}

private function userSetting(): ?string
private function lookAndFeel(): ?string
{
if (!auth()->check()) {
return null;
Expand All @@ -56,19 +51,6 @@ private function userSetting(): ?string
return null;
}

private function requestOverride(): ?string
{
/** @var Request $request */
$request = $this->app[Request::class];
if ($request->query->get('lookAndFeel') === 'legacy') {
return 'legacy';
}
if ($request->query->has('lookAndFeel')) {
return 'modern';
}
return null;
}

private function setLookAndFeel(bool $isModern): void
{
if (!auth()->check()) {
Expand Down

0 comments on commit 7356242

Please sign in to comment.