]> BookStack Code Mirror - bookstack/blobdiff - app/Activity/Controllers/WatchController.php
Fixed OIDC Logout
[bookstack] / app / Activity / Controllers / WatchController.php
index e2e27ca4afe7eede3b30fdfb8e40d4355eba8aad..3d7e18116bec0b404bd8dd804480c23ab150376d 100644 (file)
@@ -2,7 +2,6 @@
 
 namespace BookStack\Activity\Controllers;
 
-use BookStack\Activity\Models\Watch;
 use BookStack\Activity\Tools\UserEntityWatchOptions;
 use BookStack\App\Model;
 use BookStack\Entities\Models\Entity;
@@ -15,14 +14,16 @@ class WatchController extends Controller
 {
     public function update(Request $request)
     {
-        // TODO - Require notification permission
+        $this->checkPermission('receive-notifications');
+        $this->preventGuestAccess();
+
         $requestData = $this->validate($request, [
             'level' => ['required', 'string'],
         ]);
 
         $watchable = $this->getValidatedModelFromRequest($request);
         $watchOptions = new UserEntityWatchOptions(user(), $watchable);
-        $watchOptions->updateWatchLevel($requestData['level']);
+        $watchOptions->updateLevelByName($requestData['level']);
 
         $this->showSuccessNotification(trans('activities.watch_update_level_notification'));