X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/3a402f6adc78fa939d898369e425088fed141544..refs/pull/3365/head:/app/Http/Controllers/RecycleBinController.php diff --git a/app/Http/Controllers/RecycleBinController.php b/app/Http/Controllers/RecycleBinController.php index 312646008..1cffb161c 100644 --- a/app/Http/Controllers/RecycleBinController.php +++ b/app/Http/Controllers/RecycleBinController.php @@ -1,4 +1,6 @@ -middleware(function ($request, $next) { $this->checkPermission('settings-manage'); $this->checkPermission('restrictions-manage-all'); + return $next($request); }); } - /** * Show the top-level listing for the recycle bin. */ @@ -32,6 +33,7 @@ class RecycleBinController extends Controller $deletions = Deletion::query()->with(['deletable', 'deleter'])->paginate(10); $this->setPageTitle(trans('settings.recycle_bin')); + return view('settings.recycle-bin.index', [ 'deletions' => $deletions, ]); @@ -56,17 +58,19 @@ class RecycleBinController extends Controller $searching = false; } } + /** @var ?Deletion $parentDeletion */ $parentDeletion = ($currentDeletable === $deletion->deletable) ? null : $currentDeletable->deletions()->first(); return view('settings.recycle-bin.restore', [ - 'deletion' => $deletion, + 'deletion' => $deletion, 'parentDeletion' => $parentDeletion, ]); } /** * Restore the element attached to the given deletion. + * * @throws \Exception */ public function restore(string $id) @@ -77,6 +81,7 @@ class RecycleBinController extends Controller $restoreCount = (new TrashCan())->restoreFromDeletion($deletion); $this->showSuccessNotification(trans('settings.recycle_bin_restore_notification', ['count' => $restoreCount])); + return redirect($this->recycleBinBaseUrl); } @@ -95,6 +100,7 @@ class RecycleBinController extends Controller /** * Permanently delete the content associated with the given deletion. + * * @throws \Exception */ public function destroy(string $id) @@ -105,11 +111,13 @@ class RecycleBinController extends Controller $deleteCount = (new TrashCan())->destroyFromDeletion($deletion); $this->showSuccessNotification(trans('settings.recycle_bin_destroy_notification', ['count' => $deleteCount])); + return redirect($this->recycleBinBaseUrl); } /** * Empty out the recycle bin. + * * @throws \Exception */ public function empty() @@ -118,6 +126,7 @@ class RecycleBinController extends Controller $this->logActivity(ActivityType::RECYCLE_BIN_EMPTY); $this->showSuccessNotification(trans('settings.recycle_bin_destroy_notification', ['count' => $deleteCount])); + return redirect($this->recycleBinBaseUrl); } }