mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-06-01 22:39:13 +08:00
Review of #2682, Also added parent deletion link on restore
On restore, added a link to the parent deletion restore if any exists on a cascading parent. Added a test to cover this case to ensure its shown. Also tweaked default empty state message on recycle bin item list to align with new column count. Also done a little existing code cleanup including a getUrl helper on the deletion items. Related to #2682 & #2594
This commit is contained in:
@ -247,4 +247,22 @@ class RecycleBinTest extends TestCase
|
||||
$chapter->refresh();
|
||||
$this->assertNull($chapter->deleted_at);
|
||||
}
|
||||
|
||||
public function test_restore_page_shows_link_to_parent_restore_if_parent_also_deleted()
|
||||
{
|
||||
/** @var Book $book */
|
||||
$book = Book::query()->whereHas('pages')->whereHas('chapters')->with(['pages', 'chapters'])->firstOrFail();
|
||||
$chapter = $book->chapters->first();
|
||||
/** @var Page $page */
|
||||
$page = $chapter->pages->first();
|
||||
$this->asEditor()->delete($page->getUrl());
|
||||
$this->asEditor()->delete($book->getUrl());
|
||||
|
||||
$bookDeletion = $book->deletions()->first();
|
||||
$pageDeletion = $page->deletions()->first();
|
||||
|
||||
$pageRestoreView = $this->asAdmin()->get("/settings/recycle-bin/{$pageDeletion->id}/restore");
|
||||
$pageRestoreView->assertSee('The parent of this item has also been deleted.');
|
||||
$pageRestoreView->assertElementContains('a[href$="/settings/recycle-bin/' . $bookDeletion->id. '/restore"]', 'Restore Parent');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user