1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-08-06 12:02:45 +03:00

Notifications: Added new preferences view and access control

- Added general user preferences view and updated link in profile menu
  to suit.
- Made notification permission required for notification preferences
  view, added test to cover.
This commit is contained in:
Dan Brown
2023-08-14 17:29:12 +01:00
parent d9fdecd902
commit 371779205a
9 changed files with 123 additions and 29 deletions

View File

@@ -17,6 +17,14 @@ class UserPreferencesController extends Controller
) {
}
/**
* Show the overview for user preferences.
*/
public function index()
{
return view('users.preferences.index');
}
/**
* Show the user-specific interface shortcuts.
*/
@@ -53,6 +61,8 @@ class UserPreferencesController extends Controller
*/
public function showNotifications(PermissionApplicator $permissions)
{
$this->checkPermission('receive-notifications');
$preferences = (new UserNotificationPreferences(user()));
$query = Watch::query()->where('user_id', '=', user()->id);
@@ -70,6 +80,7 @@ class UserPreferencesController extends Controller
*/
public function updateNotifications(Request $request)
{
$this->checkPermission('receive-notifications');
$data = $this->validate($request, [
'preferences' => ['required', 'array'],
'preferences.*' => ['required', 'string'],