mirror of
				https://github.com/BookStackApp/BookStack.git
				synced 2025-10-31 03:50:27 +03:00 
			
		
		
		
	- Changed use of array spread since it was not supported in PHP8.0. - Updated issue templates based to reduce less valueable fields, update some details, and try to help bug reports be more focused on bugs. - Updated readme with peertube link and attribution advistory for translations PRs.
		
			
				
	
	
		
			30 lines
		
	
	
		
			964 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
		
			964 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, array_merge([
 | |
|             '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();
 | |
|     }
 | |
| }
 |