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

**URL:** https://meta.discourse.org/t/revision-history-for-flagged-post-isnt-comparing-the-correct-revisions/139585
**Category:** Bug
**Created:** [January 23, 2020, 10:50pm UTC](https://meta.discourse.org/t/revision-history-for-flagged-post-isnt-comparing-the-correct-revisions/139585 "2020-01-23T22:50:50Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Dannii](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dannii/32/129087_2.png) [@Dannii](https://meta.discourse.org/u/Dannii)
#### Post date: [January 23, 2020, 10:50pm UTC](https://meta.discourse.org/t/revision-history-for-flagged-post-isnt-comparing-the-correct-revisions/139585/1 "2020-01-23T22:50:50Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [January 23, 2020, 11:05pm UTC](https://meta.discourse.org/t/revision-history-for-flagged-post-isnt-comparing-the-correct-revisions/139585/2 "2020-01-23T23:05:13Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Dannii](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dannii/32/129087_2.png) [@Dannii](https://meta.discourse.org/u/Dannii)
#### Post date: [January 23, 2020, 11:16pm UTC](https://meta.discourse.org/t/revision-history-for-flagged-post-isnt-comparing-the-correct-revisions/139585/3 "2020-01-23T23:16:11Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [January 23, 2020, 11:16pm UTC](https://meta.discourse.org/t/revision-history-for-flagged-post-isnt-comparing-the-correct-revisions/139585/4 "2020-01-23T23:16:46Z")

</div>

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)

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [January 23, 2020, 11:23pm UTC](https://meta.discourse.org/t/revision-history-for-flagged-post-isnt-comparing-the-correct-revisions/139585/5 "2020-01-23T23:23:58Z")

</div>

I am testing this on [try.discourse.org](http://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!

 ![image](https://global.discourse-cdn.com/meta/original/3X/2/5/2549244a3663ef812c3e55cab65ec183e8ad8e1b.png)

---

<div class="post-metadata">

### Author: ![Dannii](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dannii/32/129087_2.png) [@Dannii](https://meta.discourse.org/u/Dannii)
#### Post date: [January 23, 2020, 11:28pm UTC](https://meta.discourse.org/t/revision-history-for-flagged-post-isnt-comparing-the-correct-revisions/139585/6 "2020-01-23T23:28:04Z")

</div>

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

 ![screenshot of message](https://global.discourse-cdn.com/meta/original/3X/e/1/e1d878f7b0190ab88f8a0444dd2a00eac2781f82.png)

(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:

> **[Should we distinguish between games and literature in IF?](https://intfiction.org/t/should-we-distinguish-between-games-and-literature-in-if/43903/89?u=dannii)**
>
> Here I thought sexual orientation varied across all ethnicities, economic statuses, and subgroups. It seems being poor and technically uneducated is somehow being associated with alternate sexuality. To commemorate my becoming informed on this...

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.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [January 23, 2020, 11:50pm UTC](https://meta.discourse.org/t/revision-history-for-flagged-post-isnt-comparing-the-correct-revisions/139585/7 "2020-01-23T23:50:38Z")

</div>

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:

 ![image](https://global.discourse-cdn.com/meta/original/3X/5/8/588543e177cbc6ba47924b13bb1894cdce98d076.png)

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [January 24, 2020, 12:08am UTC](https://meta.discourse.org/t/revision-history-for-flagged-post-isnt-comparing-the-correct-revisions/139585/8 "2020-01-24T00:08:53Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![markvanlan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/markvanlan/32/160087_2.png) [@markvanlan](https://meta.discourse.org/u/markvanlan)
#### Post date: [January 27, 2020, 4:08pm UTC](https://meta.discourse.org/t/revision-history-for-flagged-post-isnt-comparing-the-correct-revisions/139585/11 "2020-01-27T16:08:14Z")

</div>

I was able to track down the issue, and have merged [a fix](https://github.com/discourse/discourse/commit/20e3c0f386282dd991c20ebe1ca0479f04cc7d5f).

Nice catch finding this bug!

---

<div class="post-metadata">

### Author: ![markvanlan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/markvanlan/32/160087_2.png) [@markvanlan](https://meta.discourse.org/u/markvanlan)
#### Post date: [January 27, 2020, 4:09pm UTC](https://meta.discourse.org/t/revision-history-for-flagged-post-isnt-comparing-the-correct-revisions/139585/14 "2020-01-27T16:09:47Z")

</div>


