1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-08-07 23:03:00 +03:00

Sorting: Updated sort set command, Changed sort timestamp handling

- Renamed AssignSortSetCommand to AssignSortRuleCommand, updated
  contents and testing.
- Updated sorting operations to not update timestamps if only priority
  is changed.
This commit is contained in:
Dan Brown
2025-02-11 15:29:16 +00:00
parent b9306a9029
commit 7bd89316bc
7 changed files with 193 additions and 145 deletions

View File

@@ -2,6 +2,7 @@
namespace BookStack\Sorting;
use BookStack\App\Model;
use BookStack\Entities\Models\Book;
use BookStack\Entities\Models\BookChild;
use BookStack\Entities\Models\Chapter;
@@ -57,7 +58,7 @@ class BookSorter
foreach ($topItems as $index => $topItem) {
$topItem->priority = $index + 1;
$topItem->save();
$topItem::withoutTimestamps(fn () => $topItem->save());
}
foreach ($chapters as $chapter) {
@@ -68,7 +69,7 @@ class BookSorter
foreach ($pages as $index => $page) {
$page->priority = $index + 1;
$page->save();
$page::withoutTimestamps(fn () => $page->save());
}
}
}
@@ -166,7 +167,7 @@ class BookSorter
}
if ($chapterChanged || $priorityChanged) {
$model->save();
$model::withoutTimestamps(fn () => $model->save());
}
}