Books: On delete, redirect to shelf if in context

For #6029
Added tests to cover
This commit is contained in:
Dan Brown
2026-02-20 11:23:26 +00:00
parent 5e12b678c7
commit 8e99fc6783
3 changed files with 27 additions and 0 deletions

View File

@@ -224,9 +224,14 @@ class BookController extends Controller
{
$book = $this->queries->findVisibleBySlugOrFail($bookSlug);
$this->checkOwnablePermission(Permission::BookDelete, $book);
$contextShelf = $this->shelfContext->getContextualShelfForBook($book);
$this->bookRepo->destroy($book);
if ($contextShelf) {
return redirect($contextShelf->getUrl());
}
return redirect('/books');
}