Revision history for flagged post isn't comparing the correct revisions

AI-generated summary

A bug was reported where the revision history for a flagged and subsequently edited post incorrectly displays the same content for both revisions, making it appear as though no changes were made. Dannii initially observed this after a user edited a hidden post to make it acceptable, noting that the old, objectionable content was missing from the revision history. codinghorror initially questioned whether this could occur, given that edits after flagging should always create a new revision, but later confirmed the issue after reproducing it on try.discourse.org. The bug appears specific to edits made to hidden posts, as normal edits to visible posts do not exhibit this behavior codinghorror. Screenshots provided by Dannii showed that while the original content was visible in moderation messages, it was absent in the post’s revision history. codinghorror identified that the UI was incorrectly comparing revision 2 to itself instead of revision 1 to 2. markvanlan later tracked down and merged a fix for the issue, confirming it was a UI error in how revisions were compared for hidden posts. The fix was acknowledged as a valuable catch, resolving the misleading revision display.

A user’s post was flagged as inappropriate and hidden. They’ve edited their post to make it acceptable and it’s now not hidden. The edit history however shows the two revisions as the new content.

Does this sound like the intended behaviour? Is it because we don’t want the previous objectionable content to be visible any more? Could instead the old content be saved as a hidden revision instead?

Unless the edits happened in the grace period, which isn’t possible with a flag edit (you can’t edit for a certain amount of time), a revision is always created for the edit.

Huh. Well the old content is definitely not there any more. I guess I’ll keep an eye out for it happening and report back if I ever see it happen again.

There is no way that I know of that this can happen. It’s never been reported before, either, to my knowledge.

(unless we have a new bug or regression, somehow)

I am testing this on try.discourse.org and I can’t repro at all.

Flagging itself enforces a 10 minute “can’t edit” cooldown so the user cannot edit the post quickly enough to fit within the grace period – and that’s also assuming the post was flagged to threshold immediately after posting!

2 likes

I have a screenshot of the old content from a mod message:

(It is a bit odd that it’s shown in the post, as it’s only a link, not a quote. I guess the excerpt is baked in?)

While here is the current post, where you can see in the edit history that everything after the first two sentences isn’t present:

I also just tried it myself, and the same thing happened, the edit history was lost, both revisions show the new content (though I only tested with my admin account so it could be different). (Testing again with a regular user, taking time because of the cooldown.)

We’re on 2.4.0.beta10. Happy to test here if you like.

It is weird that in the referenced post, the revision shows but there is no difference between the revisions.

I am actually able to repro this on try! So I’ll reclassify this as bug.

There is a bug here @eviltrout – looks like a mistake in the revision UI to me, notice how I made an edit here adding the bottom sentence, but I am comparing revision 2 to revision 2 instead of revision 1 to revision 2:

3 likes

This seems to be specific to the editing path for a hidden post @eviltrout. Random edits to existing posts on try do not exhibit this behavior.

3 likes

I was able to track down the issue, and have merged a fix.

Nice catch finding this bug!

7 likes