NOW MANAGED ON CODEBERG
add priority on page and chapter create
Jean-René ROUET4d399f6ba776
diff --git a/app/Entities/Repos/ChapterRepo.php b/app/Entities/Repos/ChapterRepo.phpindex 588854c7e..dadeec7f8 100644--- a/app/Entities/Repos/ChapterRepo.php+++ b/app/Entities/Repos/ChapterRepo.php@@ -49,7 +49,7 @@ class ChapterRepo{$chapter = new Chapter();$chapter->book_id = $parentBook->id;- $chapter->priority = (new BookContents($parentBook))->getLastPriority() + 1;+ $chapter->priority = $chapter->priority ?: (new BookContents($parentBook))->getLastPriority() + 1;$this->baseRepo->create($chapter, $input);Activity::add(ActivityType::CHAPTER_CREATE, $chapter);diff --git a/app/Entities/Repos/PageRepo.php b/app/Entities/Repos/PageRepo.phpindex 521519dc0..637f4133a 100644--- a/app/Entities/Repos/PageRepo.php+++ b/app/Entities/Repos/PageRepo.php@@ -164,7 +164,7 @@ class PageRepo$draft->draft = false;$draft->revision_count = 1;- $draft->priority = $this->getNewPriority($draft);+ $draft->priority = $draft->priority ?: $this->getNewPriority($draft);$draft->save();$this->revisionRepo->storeNewForPage($draft, trans('entities.pages_initial_revision'));