Notifications: Made improvements from manual testing

- Added titles for preference pages.
- Added extra check for non-guest for notifications on preferences page.
This commit is contained in:
Dan Brown 2023-08-16 20:15:49 +01:00
parent 565908ef52
commit 79470ea4b7
No known key found for this signature in database
GPG Key ID: 46D9F943C24A2EF9
3 changed files with 7 additions and 2 deletions

View File

@ -33,6 +33,8 @@ class UserPreferencesController extends Controller
$shortcuts = UserShortcutMap::fromUserPreferences(); $shortcuts = UserShortcutMap::fromUserPreferences();
$enabled = setting()->getForCurrentUser('ui-shortcuts-enabled', false); $enabled = setting()->getForCurrentUser('ui-shortcuts-enabled', false);
$this->setPageTitle(trans('preferences.shortcuts_interface'));
return view('users.preferences.shortcuts', [ return view('users.preferences.shortcuts', [
'shortcuts' => $shortcuts, 'shortcuts' => $shortcuts,
'enabled' => $enabled, 'enabled' => $enabled,
@ -70,6 +72,7 @@ class UserPreferencesController extends Controller
$query = $permissions->restrictEntityRelationQuery($query, 'watches', 'watchable_id', 'watchable_type'); $query = $permissions->restrictEntityRelationQuery($query, 'watches', 'watchable_id', 'watchable_type');
$watches = $query->with('watchable')->paginate(20); $watches = $query->with('watchable')->paginate(20);
$this->setPageTitle(trans('preferences.notifications'));
return view('users.preferences.notifications', [ return view('users.preferences.notifications', [
'preferences' => $preferences, 'preferences' => $preferences,
'watches' => $watches, 'watches' => $watches,

View File

@ -13,7 +13,7 @@
</div> </div>
</section> </section>
@if(userCan('receive-notifications')) @if(signedInUser() && userCan('receive-notifications'))
<section class="card content-wrap auto-height items-center justify-space-between gap-m flex-container-row"> <section class="card content-wrap auto-height items-center justify-space-between gap-m flex-container-row">
<div> <div>
<h2 class="list-heading">{{ trans('preferences.notifications') }}</h2> <h2 class="list-heading">{{ trans('preferences.notifications') }}</h2>

View File

@ -15,13 +15,15 @@ class UserPreferencesTest extends TestCase
$resp->assertSee('Edit Profile'); $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->setSettings(['app-public' => 'true']);
$this->permissions->grantUserRolePermissions($this->users->guest(), ['receive-notifications']);
$resp = $this->get('/preferences'); $resp = $this->get('/preferences');
$resp->assertOk(); $resp->assertOk();
$resp->assertSee('Interface Keyboard Shortcuts'); $resp->assertSee('Interface Keyboard Shortcuts');
$resp->assertDontSee('Edit Profile'); $resp->assertDontSee('Edit Profile');
$resp->assertDontSee('Notification');
} }
public function test_interface_shortcuts_updating() public function test_interface_shortcuts_updating()
{ {