mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-11-26 02:10:19 +08:00
2fbf5527c7
Fixes #4444
31 lines
965 B
PHP
31 lines
965 B
PHP
<?php
|
|
|
|
namespace BookStack\Activity\Controllers;
|
|
|
|
use BookStack\Activity\Tools\UserEntityWatchOptions;
|
|
use BookStack\Entities\Tools\MixedEntityRequestHelper;
|
|
use BookStack\Http\Controller;
|
|
use Illuminate\Http\Request;
|
|
|
|
class WatchController extends Controller
|
|
{
|
|
public function update(Request $request, MixedEntityRequestHelper $entityHelper)
|
|
{
|
|
$this->checkPermission('receive-notifications');
|
|
$this->preventGuestAccess();
|
|
|
|
$requestData = $this->validate($request, [
|
|
'level' => ['required', 'string'],
|
|
...$entityHelper->validationRules()
|
|
]);
|
|
|
|
$watchable = $entityHelper->getVisibleEntityFromRequestData($requestData);
|
|
$watchOptions = new UserEntityWatchOptions(user(), $watchable);
|
|
$watchOptions->updateLevelByName($requestData['level']);
|
|
|
|
$this->showSuccessNotification(trans('activities.watch_update_level_notification'));
|
|
|
|
return redirect()->back();
|
|
}
|
|
}
|