X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/bc6e19b2a1ef424d6901cf07c179e445deede08e..refs/pull/4467/head:/app/Activity/Controllers/WatchController.php diff --git a/app/Activity/Controllers/WatchController.php b/app/Activity/Controllers/WatchController.php index e2e27ca4a..3d7e18116 100644 --- a/app/Activity/Controllers/WatchController.php +++ b/app/Activity/Controllers/WatchController.php @@ -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'));