diff --git a/app/Users/Controllers/UserPreferencesController.php b/app/Users/Controllers/UserPreferencesController.php index d73bb2d0c..503aeaeb0 100644 --- a/app/Users/Controllers/UserPreferencesController.php +++ b/app/Users/Controllers/UserPreferencesController.php @@ -33,6 +33,8 @@ class UserPreferencesController extends Controller $shortcuts = UserShortcutMap::fromUserPreferences(); $enabled = setting()->getForCurrentUser('ui-shortcuts-enabled', false); + $this->setPageTitle(trans('preferences.shortcuts_interface')); + return view('users.preferences.shortcuts', [ 'shortcuts' => $shortcuts, 'enabled' => $enabled, @@ -70,6 +72,7 @@ class UserPreferencesController extends Controller $query = $permissions->restrictEntityRelationQuery($query, 'watches', 'watchable_id', 'watchable_type'); $watches = $query->with('watchable')->paginate(20); + $this->setPageTitle(trans('preferences.notifications')); return view('users.preferences.notifications', [ 'preferences' => $preferences, 'watches' => $watches, diff --git a/resources/views/users/preferences/index.blade.php b/resources/views/users/preferences/index.blade.php index a79245acb..689628370 100644 --- a/resources/views/users/preferences/index.blade.php +++ b/resources/views/users/preferences/index.blade.php @@ -13,7 +13,7 @@ - @if(userCan('receive-notifications')) + @if(signedInUser() && userCan('receive-notifications'))

{{ trans('preferences.notifications') }}

diff --git a/tests/User/UserPreferencesTest.php b/tests/User/UserPreferencesTest.php index bc023b4cd..4ee04ea67 100644 --- a/tests/User/UserPreferencesTest.php +++ b/tests/User/UserPreferencesTest.php @@ -15,13 +15,15 @@ class UserPreferencesTest extends TestCase $resp->assertSee('Edit Profile'); } - public function test_index_view_accessible_but_without_profile_for_guest_user() + public function test_index_view_accessible_but_without_profile_and_notifications_for_guest_user() { $this->setSettings(['app-public' => 'true']); + $this->permissions->grantUserRolePermissions($this->users->guest(), ['receive-notifications']); $resp = $this->get('/preferences'); $resp->assertOk(); $resp->assertSee('Interface Keyboard Shortcuts'); $resp->assertDontSee('Edit Profile'); + $resp->assertDontSee('Notification'); } public function test_interface_shortcuts_updating() {