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:
@@ -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'],
|
||||
|
Reference in New Issue
Block a user