Discard Draft does not delete draft #3409

Closed
opened 2026-02-05 06:37:50 +03:00 by OVERLORD · 3 comments
Owner

Originally created by @ThaMunsta on GitHub (Dec 20, 2022).

Describe the Bug

A saved draft is not removed from the database by clicking Discard Draft at the top of the page.

Steps to Reproduce

  1. Create a new page (or edit an existing)
  2. Type some changes
  3. Save your draft using the link at the top of the edit page
  4. Discard your draft using the link at the top of the edit page
  5. Refresh the browser window (or open the MySQL database)
  6. You are now editing the same draft from earlier (or find the draft still in the MySQL database)

Expected Behaviour

The button named Discard Draft should remove the stored changes from the database so a user doesn't go in to edit the page later and save edits from an old draft that were not intended to be "remembered". Ideally this will also prevent the warning about unsaved changes when you are navigating away from the page.

Screenshots or Additional Context

The two buttons in question are at the top of the page and look like this:
image

Browser Details

Chrome Version 108.0.5359.125 on Windows 10 21H2

Exact BookStack Version

v22.11.1

PHP Version

PHP 8.0.25

Hosting Environment

Docker Image (linuxserver/bookstack:latest) hosted behind Nginx Proxy Manager.
Reproduced on https://demo.bookstackapp.com/ logged in as admin.
Originally discovered on older version (v21 something I believe) but looking at the docs and page-editor.js it might have been this way for a while. If it was intentional - my apologies.

Originally created by @ThaMunsta on GitHub (Dec 20, 2022). ### Describe the Bug A saved draft is not removed from the database by clicking Discard Draft at the top of the page. ### Steps to Reproduce 1. Create a new page (or edit an existing) 2. Type some changes 3. Save your draft using the link at the top of the edit page 4. Discard your draft using the link at the top of the edit page 5. Refresh the browser window (or open the MySQL database) 6. You are now editing the same draft from earlier (or find the draft still in the MySQL database) ### Expected Behaviour The button named Discard Draft should remove the stored changes from the database so a user doesn't go in to edit the page later and save edits from an old draft that were not intended to be "remembered". Ideally this will also prevent the warning about unsaved changes when you are navigating away from the page. ### Screenshots or Additional Context The two buttons in question are at the top of the page and look like this: ![image](https://user-images.githubusercontent.com/3221579/208736731-eacdcfe2-b45c-48cb-aeb6-8de02fb8e69c.png) ### Browser Details Chrome Version 108.0.5359.125 on Windows 10 21H2 ### Exact BookStack Version v22.11.1 ### PHP Version PHP 8.0.25 ### Hosting Environment Docker Image (linuxserver/bookstack:latest) hosted behind Nginx Proxy Manager. Reproduced on https://demo.bookstackapp.com/ logged in as admin. Originally discovered on older version (v21 something I believe) but looking at the docs and `page-editor.js` it might have been this way for a while. If it was intentional - my apologies.
OVERLORD added the 🛠️ Enhancement🐛 Bug🔨 Feature Request labels 2026-02-05 06:37:50 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Jan 26, 2023):

Thanks for the clear report @ThaMunsta.

The "Discard Draft" button has always just discarded the draft content (Re-fetches current saved page content) from the editor, and not touched the database, but I can see how this is not clear by the action name, and with it being alongside the "Save Draft" button which is a database action. Also can understand why you'd want to be able to actually delete the draft.

Maybe we need to provide two options:

  • A "Discard Draft" button that actually deletes from the database.
  • A "Restore Non-Draft Content" button that does the current behaviour.

Ideally would want more concise wording for that second option.


Maintainer Note

  • Would need show an update advisory if we do the above since it changes the behaviour of the "Discord Draft" button while having the same name.
@ssddanbrown commented on GitHub (Jan 26, 2023): Thanks for the clear report @ThaMunsta. The "Discard Draft" button has always just discarded the draft content (Re-fetches current saved page content) from the editor, and not touched the database, but I can see how this is not clear by the action name, and with it being alongside the "Save Draft" button which is a database action. Also can understand why you'd want to be able to actually delete the draft. Maybe we need to provide two options: - A "Discard Draft" button that actually deletes from the database. - A "Restore Non-Draft Content" button that does the current behaviour. Ideally would want more concise wording for that second option. --- #### Maintainer Note - Would need show an update advisory if we do the above since it changes the behaviour of the "Discord Draft" button while having the same name.
Author
Owner

@ThaMunsta commented on GitHub (Jan 27, 2023):

I'll throw my name suggestion in the hat:

  • A "Delete Draft" button that actually deletes from the database. Everyone knows what delete means.
  • A "Discard Changes" button that does the current behaviour. Or more verbose: "Discard Current Changes"

I think especially displayed in that order, it will be easy to understand what the second button does.

Thanks for taking the time to read this!

@ThaMunsta commented on GitHub (Jan 27, 2023): I'll throw my name suggestion in the hat: - A "Delete Draft" button that actually deletes from the database. Everyone knows what delete means. - A "Discard Changes" button that does the current behaviour. Or more verbose: "Discard Current Changes" I think especially displayed in that order, it will be easy to understand what the second button does. Thanks for taking the time to read this!
Author
Owner

@ssddanbrown commented on GitHub (Jun 13, 2023):

Within b01bbf9c89 as new "Delete Draft" button has been added alongside the existing option to delete the user draft and discard the editor content back to last saved state. This includes a confirmation before the action is taken, since there's a higher risk of data loss with this action.

This will be part of the next feature release.

@ssddanbrown commented on GitHub (Jun 13, 2023): Within b01bbf9c8900ee2cc182f47d34aaa682bf1aa244 as new "Delete Draft" button has been added alongside the existing option to delete the user draft and discard the editor content back to last saved state. This includes a confirmation before the action is taken, since there's a higher risk of data loss with this action. 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#3409