Edits not properly reset with Shared Drafts

AI-generated summary

The discussion revolves around an issue with the Shared Drafts feature in Discourse, where edits are not properly reset. jomaxro discovered the problem while creating a topic and reported the following issues:

  • Anonymous and non-staff users can see all edits, including hidden ones, instead of none.
  • The edit history modal is blank for these users.
  • The expected behavior is for only staff users to see the hidden edit.

jomaxro also mentioned that the grace edit window didn’t apply after publishing, which might be a separate bug.

eviltrout fixed the issue with a commit to the Discourse repository, addressing the difference between public_version and private_version. Another commit by eviltrout aimed to fix the “ninja editing” issue.

Used the new Shared Drafts feature when writing up Discourse 2.0.0.beta5 Release Notes today. Prior to publishing the topic I made 2 edits. After publishing the topic I made another edit, which I then hid via “hide revision”.

Expected Results:

Anonymous viewer: no edits seen.
Non-staff user: no edits seen.
Staff user: 1 edit seen (but hidden).

Actual Results:

:x: Anonymous viewer: 3 edits seen. Blank edit history modal.
:x: Non-staff user: 3 edits seen. Blank edit history modal.
:white_check_mark: Staff user: 1 edit seen (but hidden)


Anon/logged in user view:

cc @eviltrout

An aside (maybe a bug?) - the grace edit window didn’t seem to apply after publishing. The post publishing edit was made with 10 seconds of publishing the posts, and changed less characters than the editing grace period max diff high trust (400). I’d expect it to be a grace edit and thus not logged?

7 Likes

Fixed here. I didn’t realize there’s a public_version that’s separate from the private_version:

https://github.com/discourse/discourse/commit/d4296f33fffa6d61d44aa948900e4fca9baa19d3

7 Likes

Also, this should fix the ninja editing:

https://github.com/discourse/discourse/commit/f03b6bd8c925163b41b9e33b39484d102dbaee44

7 Likes