Manual sort of pages/chapters in a book does not work #6118

Open
opened 2026-04-24 17:16:55 +02:00 by Maarten-TL · 2 comments
Maarten-TL commented 2026-04-24 17:16:55 +02:00 (Migrated from github.com)

Describe the Bug

I have a book (on a shelf) and that book has several chapters, some with pages and some without pages; it also has a few individual pages that are not part of a chapter. I am trying to move one of those 'individual pages' into an existing chapter by using the 'sort' function available on the 'book' page.

The sort page is correctly opened and I can move things around, including moving the page into the chapter. when I click 'Save New Order' the UI goes back to the book page with a little popup indicating the change was saved successfully, but the page has not actually moved.

Upon further testing, it seems I cannot change the order or location of individual pages, but I can change the order of pages that are already in a chapter. I can also reorder chapters. Just not individual pages that are outside any chapter.

I assume this is a bug as the UI does allow me to make these modifications and confirms my changes are saved. I can imagine "moving a page into a chapter" and "changing the sort order of pages" could be considered two separate actions, but neither of these work (for individual pages).

I did not try moving a page from within a chapter to outside it as I don't want to risk "irreversible damage" to my book :) As I am not a sysadmin on 'our' bookstack I don't know for sure what version we are on, but it's generally kept up to date, so it should be the latest release or the second latest if it's less than a month or so old. I am by the way 'owner' of the book and the shelf that the book is on.

I see one resolved sorting issue that is somewhat similar but not exactly: #4700 which is different because the example shown there (2 pages inside a chapter) does work for me; and one open issue #5074 which describes the same situation as 4700 (2 pages inside a chapter) and thus is not the same as my issue.

Steps to Reproduce

Go to a book, click on 'sort', move a page that is in the book (but not in a chapter) into an existing chapter, click 'save'.

Expected Behaviour

Sort order is updated and visible on the reloaded 'book' page

Screenshots or Additional Context

No response

Browser Details

Edge 146.0.3856.97 (Official build) (arm64) on MacOS Sequoia 15.7.5 (24G624)

Exact BookStack Version

undetermined, but latest or second-latest. If critical can find out next week

### Describe the Bug I have a book (on a shelf) and that book has several chapters, some with pages and some without pages; it also has a few individual pages that are not part of a chapter. I am trying to move one of those 'individual pages' into an existing chapter by using the 'sort' function available on the 'book' page. The sort page is correctly opened and I can move things around, including moving the page into the chapter. when I click 'Save New Order' the UI goes back to the book page with a little popup indicating the change was saved successfully, but the page has not actually moved. Upon further testing, it seems I cannot change the order or location of individual pages, but I can change the order of pages that are already in a chapter. I can also reorder chapters. Just not individual pages that are outside any chapter. I assume this is a bug as the UI does allow me to make these modifications and confirms my changes are saved. I can imagine "moving a page into a chapter" and "changing the sort order of pages" could be considered two separate actions, but neither of these work (for individual pages). I did not try moving a page from within a chapter to outside it as I don't want to risk "irreversible damage" to my book :) As I am not a sysadmin on 'our' bookstack I don't know for sure what version we are on, but it's generally kept up to date, so it should be the latest release or the second latest if it's less than a month or so old. I am by the way 'owner' of the book and the shelf that the book is on. I see one resolved sorting issue that is somewhat similar but not exactly: #4700 which is different because the example shown there (2 pages inside a chapter) does work for me; and one open issue #5074 which describes the same situation as 4700 (2 pages inside a chapter) and thus is not the same as my issue. ### Steps to Reproduce Go to a book, click on 'sort', move a page that is in the book (but not in a chapter) into an existing chapter, click 'save'. ### Expected Behaviour Sort order is updated and visible on the reloaded 'book' page ### Screenshots or Additional Context _No response_ ### Browser Details Edge 146.0.3856.97 (Official build) (arm64) on MacOS Sequoia 15.7.5 (24G624) ### Exact BookStack Version undetermined, but latest or second-latest. If critical can find out next week

I am not a sysadmin on 'our' bookstack

I just spent half an hour trying to figure out a similar problem, only to find out that I didn't have the necessary permissions for the page.

Have you checked whether you have delete permissions on the page you want to move? Update permissions alone aren’t enough.
Or ask your admins if they can change the order. If it works for them, this would suggest a permission issue.

Unfortunately, if the necessary permissions are missing, Bookstack silently fails to process the distinct sort item, while the sort-command itself reports being succesful. A corresponding error message in the UI would be helpful.

> I am not a sysadmin on 'our' bookstack I just spent half an hour trying to figure out a similar problem, only to find out that I didn't have the necessary permissions for the page. Have you checked whether you have delete permissions on the page you want to move? Update permissions alone aren’t enough. Or ask your admins if they can change the order. If it works for them, this would suggest a permission issue. Unfortunately, if the necessary permissions are missing, Bookstack silently fails to process the distinct sort item, while the sort-command itself reports being succesful. A corresponding error message in the UI would be helpful.

@mueller-contria wrote in #6118 (comment):

Have you checked whether you have delete permissions on the page you want to move? Update permissions alone aren’t enough.

To elaborate on this, as I have also encountered this issue on a bookstack instance:

When "moving" something (pages across chapters / books, or chapters across books) the user needs the delete permission on the original location and the create permission on the new one. When "reordering", these permissions are not necessary.

Whether or not an operation is considered "moving" is triggered by the variable $hasNewParent at

$hasNewParent = $newBook->id !== $model->book_id || ($model instanceof Page && $model->chapter_id !== ($sortMapItem->parentChapterId ?? 0));

Re-ordering pages within a chapter or re-ordering chapters within a book does not count as moving, but re-ordering pages within a book (the page's parent being a book) does count as moving. I believe that the latter is unintended behavior.

At least on our instance, giving the appropriate permissions (delete and create on all items) does allow all reordering and moving.

@mueller-contria wrote in https://codeberg.org/bookstack/bookstack/issues/6118#issuecomment-14663016: > Have you checked whether you have delete permissions on the page you want to move? Update permissions alone aren’t enough. To elaborate on this, as I have also encountered this issue on a bookstack instance: When "moving" something (pages across chapters / books, or chapters across books) the user needs the delete permission on the original location and the create permission on the new one. When "reordering", these permissions are not necessary. Whether or not an operation is considered "moving" is triggered by the variable `$hasNewParent` at https://codeberg.org/bookstack/bookstack/src/commit/50d3be4c95fb9ed17699a86cafc5634c22972250/app/Sorting/BookSorter.php#L191 Re-ordering pages within a chapter or re-ordering chapters within a book does not count as moving, but re-ordering pages within a book (the page's parent being a book) does count as moving. I believe that the latter is unintended behavior. At least on our instance, giving the appropriate permissions (delete and create on all items) does allow all reordering and moving.
Sign in to join this conversation.
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
bookstack/bookstack#6118
No description provided.