1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-30 04:23:11 +03: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:
Dan Brown
2021-06-26 12:12:11 +01:00
parent 8a9505bf8c
commit 3a402f6adc
7 changed files with 63 additions and 9 deletions

View File

@ -266,10 +266,10 @@ abstract class Entity extends Model implements Sluggable, Favouritable, Viewable
*/
public function getParent(): ?Entity
{
if ($this->isA('page')) {
if ($this instanceof Page) {
return $this->chapter_id ? $this->chapter()->withTrashed()->first() : $this->book()->withTrashed()->first();
}
if ($this->isA('chapter')) {
if ($this instanceof Chapter) {
return $this->book()->withTrashed()->first();
}
return null;