RGJ
(Richard - Communiteq)
4 באפריל, 2026, 3:26pm
1
create a post
save it
click the pencil
edit it
decide not to
click Discard
Get a popup “Do you want to discard your post?”
Everytime this happens I get confused, even after all those years.
When editing a post (as opposed to creating a post or topic), the initial button (the one next to “Save Edit”) should be Cancel Edit or Stop Editing , not Discard , and the popup message should read “Do you want to discard your edits?”
The popup also activates when there are no edits at all.
12 לייקים
Thanks for the report @RGJ It’ll be fixed by
main ← fix/composer-discard-editing-context
merged 09:07PM - 14 Apr 26 UTC
When editing a post, the composer's cancel button said "Discard" and the confirm… ation modal said "Do you want to discard your post?" — which sounds like you're deleting the post itself. Additionally, the modal appeared even when no edits were made.
**BEFORE**
| Scenario | Cancel button | Modal message | Modal OK |
|-----------------|---------------|------------------------------------|----------|
| Create topic | Discard | Do you want to discard your post? | Discard |
| Reply | Discard | Do you want to discard your post? | Discard |
| Edit | Discard | Do you want to discard your post? | Discard |
| Private message | Discard | Do you want to discard your post? | Discard |
\+ 🐛 bug: edit modal appears even with no changes
**AFTER**
| Scenario | Cancel button | Modal message | Modal OK |
|-----------------|---------------|---------------------------------------|-----------------|
| Create topic | Discard | Do you want to discard your post? | Discard |
| Reply | Discard | Do you want to discard your post? | Discard |
| Edit | Cancel edit | Do you want to discard your changes? | Discard changes |
| Private message | Discard | Do you want to discard your post? | Discard |
The false dirty state had two causes:
1. `anyDirty` included `titleDirty` even when editing non-first posts where the title isn't editable. The title was set to the topic title during the `serialize(_edit_topic_serializer)` call but `originalTitle` was only set for first posts, making `titleDirty` always true. Fixed by scoping `titleDirty` in `anyDirty` to only apply when `canEditTitle` is true, and by always setting `originalTitle` when loading a post for editing.
2. `hasMetaData` had inverted logic — `isEmpty(Object.keys(this.metaData))` returned true when metadata was empty, not when it had keys.
https://meta.discourse.org/t/399942
4 לייקים