Ho una correzione in lavorazione che risolverà il problema della doppia revisione durante la modifica solo del titolo/tag/categoria e l’aggiunta di un motivo di modifica… spero venga unita la prossima settimana!
main ← fix-metadata-edit-reason
opened 05:33PM - 20 Feb 26 UTC
Issues surfaced in https://meta.discourse.org/t/commit-message-functionality-for… -topic-title-edits/320314
When someone uses the composer to edit the topic metadata (title, category, tag) and includes an edit reason we were running both `post.save()` (includes the edit reason) and `Topic.update()` for the metadata. This resulted in two separate post revisions in the history, one for the content (which didn't actually change!) and one for the metadata.
The fix is to check if the actual post content changes when saving the first post, and skip `post.save()` if it hasn't. To make this work with an edit reason, we also need to ensure the edit reason can be saved when calling `Topic.update()`
Added tests to make sure this doesn't regress.
Before (two revisions in history)
<img width="2690" height="370" alt="image" src="https://github.com/user-attachments/assets/4c153c44-a9a1-4b81-b483-7e6ff945fb93" />
<img width="2680" height="314" alt="image" src="https://github.com/user-attachments/assets/7ed067b2-a6cf-4cca-a5b0-dbd0e074a333" />
After (one revision)
<img width="2682" height="350" alt="image" src="https://github.com/user-attachments/assets/bf62fb47-f9e0-43fb-bb53-bd12b730712d" />
1 Mi Piace