There is a situation where the page API cannot retrieve the editor type. #4870

Closed
opened 2026-02-05 09:22:36 +03:00 by OVERLORD · 2 comments
Owner

Originally created by @toras9000 on GitHub (Jul 13, 2024).

Describe the Bug

In the newly created page, the editor property is empty in the PAGES-LIST or PAGES-READ API response results.
This seems to occur when a new page is saved with the configured default editor.
When creating or editing a page, if you switch the editor type and then save the page, the type will be available in the editor property of the API response thereafter.

Steps to Reproduce

  1. Create a new page in any book.
    • At this time, save the file without switching the editor type.
  2. Obtain information via the PAGES-LIST or PAGES-READ API.
    • The editor property of the API response data is empty.

Expected Behaviour

The editor property of the API response gets the appropriate value.

Screenshots or Additional Context

No response

Browser Details

No response

Exact BookStack Version

v24.05.2

Originally created by @toras9000 on GitHub (Jul 13, 2024). ### Describe the Bug In the newly created page, the `editor` property is empty in the PAGES-LIST or PAGES-READ API response results. This seems to occur when a new page is saved with the configured default editor. When creating or editing a page, if you switch the editor type and then save the page, the type will be available in the `editor` property of the API response thereafter. ### Steps to Reproduce 1. Create a new page in any book. - At this time, save the file without switching the editor type. 1. Obtain information via the PAGES-LIST or PAGES-READ API. - The `editor` property of the API response data is empty. ### Expected Behaviour The `editor` property of the API response gets the appropriate value. ### Screenshots or Additional Context _No response_ ### Browser Details _No response_ ### Exact BookStack Version v24.05.2
OVERLORD added the 🐛 Bug🏭 Back-End labels 2026-02-05 09:22:36 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Jul 14, 2024):

Thanks for raising @toras9000, I can confirm this.
I've assigned to the next feature release rather than fix this in a sooner patch because we'll want to apply some database changes to address this fully which is something I'd rather leave to non-minor versions.

Dev notes

System currently won't set editor value if aligned with system default.
Probably worth updating the change logic to actually update, even if without permissions but existing value is empty as a backup option:

a8ce199e0d/app/Entities/Repos/PageRepo.php (L146-L148)

But ultimately the value needs to be set on initial page creation/store.

Should also update the existing pages without editor values, for which I think we can follow the original logic we used for the field on column creation:

45d52f27ae/database/migrations/2022_04_17_101741_add_editor_change_field_and_permission.php (L21-L27)

@ssddanbrown commented on GitHub (Jul 14, 2024): Thanks for raising @toras9000, I can confirm this. I've assigned to the next feature release rather than fix this in a sooner patch because we'll want to apply some database changes to address this fully which is something I'd rather leave to non-minor versions. ### Dev notes System currently won't set editor value if aligned with system default. Probably worth updating the change logic to actually update, even if without permissions but existing value is empty as a backup option: https://github.com/BookStackApp/BookStack/blob/a8ce199e0de8974c8be60450797301839a5d1e82/app/Entities/Repos/PageRepo.php#L146-L148 **But ultimately the value needs to be set on initial page creation/store.** Should also update the existing pages without editor values, for which I think we can follow the original logic we used for the field on column creation: https://github.com/BookStackApp/BookStack/blob/45d52f27ae578e00b8d45d6848ffcefede6015d6/database/migrations/2022_04_17_101741_add_editor_change_field_and_permission.php#L21-L27
Author
Owner

@ssddanbrown commented on GitHub (Sep 29, 2024):

This has now been updated in 89f84c9a95 to always set an editor type, and this will be part of the next feature release.

@ssddanbrown commented on GitHub (Sep 29, 2024): This has now been updated in 89f84c9a95babfa5bf8b3d38809375e59cab80ce to always set an editor type, and this will be part of the next feature release.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#4870