]> BookStack Code Mirror - bookstack/commitdiff
Users: Hid lanuage preference for guest user
authorDan Brown <redacted>
Fri, 13 Dec 2024 15:19:09 +0000 (15:19 +0000)
committerDan Brown <redacted>
Fri, 13 Dec 2024 15:19:28 +0000 (15:19 +0000)
Hiding since it's not really used, and may mislead on how to set default
app language (which should be done via env options).
Updated test to cover.

For #5356

resources/views/users/edit.blade.php
tests/User/UserManagementTest.php

index 2b736d81edeebad3b99ed0d59b391a98d0618b8b..611653d6a801ba7d2bec847344e258bfff13b0c2 100644 (file)
@@ -34,7 +34,9 @@
                         </div>
                     </div>
 
-                    @include('users.parts.language-option-row', ['value' => old('language') ?? $user->getLocale()->appLocale()])
+                    @if(!$user->isGuest())
+                        @include('users.parts.language-option-row', ['value' => old('language') ?? $user->getLocale()->appLocale()])
+                    @endif
                 </div>
 
                 <div class="text-right">
index 37d9b383544bbc66d5eeab3bead7b157ecc4fcb8..d92f13f0b3ff7624a58ba95298412a19bf6da152 100644 (file)
@@ -202,9 +202,13 @@ class UserManagementTest extends TestCase
     public function test_guest_profile_shows_limited_form()
     {
         $guest = $this->users->guest();
+
         $resp = $this->asAdmin()->get('/settings/users/' . $guest->id);
         $resp->assertSee('Guest');
-        $this->withHtml($resp)->assertElementNotExists('#password');
+        $html = $this->withHtml($resp);
+
+        $html->assertElementNotExists('#password');
+        $html->assertElementNotExists('[name="language"]');
     }
 
     public function test_guest_profile_cannot_be_deleted()