# Watched words triggered when editing old posts

**URL:** https://meta.discourse.org/t/watched-words-triggered-when-editing-old-posts/69355
**Category:** Bug
**Created:** [September 4, 2017, 10:53pm UTC](https://meta.discourse.org/t/watched-words-triggered-when-editing-old-posts/69355 "2017-09-04T22:53:23Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![RobMeade](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/robmeade/32/109119_2.png) [@RobMeade](https://meta.discourse.org/u/RobMeade)
#### Post date: [September 4, 2017, 10:53pm UTC](https://meta.discourse.org/t/watched-words-triggered-when-editing-old-posts/69355/1 "2017-09-04T22:53:23Z")

</div>

Hi,

I’m not sure if what I am experiencing is intended behaviour or not, so I thought I would ask.

I have today added some words to watch for, profanity etc.

I have tread gently initially and just set Discourse to Flag the posts as inappropriate rather than take any action. This evening one post triggered this and I took a look - working really nicely.

I then searched the entire forum for some various words and found some posts which contained them. I edited the posts, replacing the word with asterisks. Having done this on about 4 posts I noticed that I now had four new flags!

It would seem that the version history of the post, which still contains the original word, is triggering a flag to be raised. When you view it you of course only see the most recent version and thus it isn’t clear as to why the post is deemed inappropriate.

Even as an Admin I am unable to edit previous versions of a post (as far as I know), so I don’t think there is a manual way to avoid this issue.

Any thoughts from those of you that work on / know the system much better than I?

---

<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: [September 5, 2017, 11:12am UTC](https://meta.discourse.org/t/watched-words-triggered-when-editing-old-posts/69355/2 "2017-09-05T11:12:47Z")

</div>

> [@RobMeade](#):
>
> It would seem that the version history of the post, which still contains the original word, is triggering a flag to be raised. When you view it you of course only see the most recent version and thus it isn’t clear as to why the post is deemed inappropriate.

I wouldn’t describe it that way – your edit of the old post with the “bad” word is triggering a run of the watched words check. I doubt @neil tested this scenario.

I’ve edited the title to more accurately reflect what is going on and changed to bug since this is definitely a bug IMO.

---

<div class="post-metadata">

### Author: ![RobMeade](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/robmeade/32/109119_2.png) [@RobMeade](https://meta.discourse.org/u/RobMeade)
#### Post date: [September 5, 2017, 11:16am UTC](https://meta.discourse.org/t/watched-words-triggered-when-editing-old-posts/69355/3 "2017-09-05T11:16:36Z")

</div>

Hi Jeff,

Thanks for the feedback and clarity.

Sorry I often only bring problems and not solutions! 🙂

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [September 11, 2017, 2:19pm UTC](https://meta.discourse.org/t/watched-words-triggered-when-editing-old-posts/69355/5 "2017-09-11T14:19:55Z")

</div>

I can’t reproduce this. Here’s what I tried:

- As an **admin** user
- find a post by a non-staff user
- add a word in the post to the “Flag” list in Watched Words
- edit the post to replace the word to “\*\*\*\*\*\*”

Expect to see a new flag, but I don’t.

@RobMeade How can I reproduce?

---

<div class="post-metadata">

### Author: ![RobMeade](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/robmeade/32/109119_2.png) [@RobMeade](https://meta.discourse.org/u/RobMeade)
#### Post date: [September 11, 2017, 3:09pm UTC](https://meta.discourse.org/t/watched-words-triggered-when-editing-old-posts/69355/6 "2017-09-11T15:09:31Z")

</div>

Hi @neil,

I have just had a post flag up on our hosted solution (GameDevTV). I will go in and amend the profanity that has been entered and record the steps to reproduce for you.

I will update this response in a few moments.

* * *

These steps are from a post **_already_** being reported(flagged) for inappropriate content and does not create the flag.

- Click on Flags

- Click on the topic title

- Click on the Edit tool

- Edit the offending text

- Enter a _Reason for Edit_

- Click on the Save Edit button

- Return to the _Flags_ page

- Click on the _Agree_ button, choosing _Agree_ (e.g. not sending a PM)

* * *

These steps are where a search is performed to find posts that contain the watched word (e.g. were posted before the watch words were added);

_Additional step to create content to test against_

- Create a post using a word which is currently _not_ in the Watched Word list, for example; **kowabunga**

_Steps_

- Add the watched word to the Watched Word list

- Perform a search across the forum for the newly added Watched Word (e.g. **kowabunga** )

- Click on the topic title

- Click on the _Edit_ tool

- Replace the offending word

- Enter a _Reason for Edit_

- Click on the Save Edit button

* * *

At this time, this has _not_ triggered a flag to be generated. That said, I just posted with a word that was _already_ on the Watched Word list and that didn’t either.

**Question**

- Are Watched Words checked for _instantly_, or as part of a job that runs periodically in the background?
- If an Administrator posts, does this get excluded from the checks?

In the above, I posted using my Administrator account, and nothing has appeared at all yet (within 10 minutes of posting)

* * *

**Related Issue**

On a very related, although not specifically the same, matter, we have had images uploaded which contained a Watched Word in the filename. These escape any form of validation and are allowed to be uploaded.

I have tried;

- download the original image
- save it locally with a new name
- edit the post, delete the image
- re-upload the image with the amended file name

But the alt/hover/title text remains as per the original image.

I suspect there is perhaps some cleverness going on in the background to determine if the image was in fact the same image and thus not upload it again.

The only way I have been able to circumvent this was to save the image locally with a different file extension (e.g. jpg instead of png or vice versa), then the image was treated as a new image and the alt/hover/title text was corrected also.

* * *

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [September 11, 2017, 5:12pm UTC](https://meta.discourse.org/t/watched-words-triggered-when-editing-old-posts/69355/7 "2017-09-11T17:12:12Z")

</div>

> [@RobMeade](#):
>
> At this time, this has not triggered a flag to be generated. That said, I just posted with a word that was already on the Watched Word list and that didn’t either.
> 
> Question
> 
> Are Watched Words checked for instantly, or as part of a job that runs periodically in the background?  
> If an Administrator posts, does this get excluded from the checks?
> 
> In the above, I posted using my Administrator account, and nothing has appeared at all yet (within 10 minutes of posting)

Staff are excluded from the checks, so what you’re seeing is correct. So those steps are the same as what you reported in your first post?

---

<div class="post-metadata">

### Author: ![RobMeade](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/robmeade/32/109119_2.png) [@RobMeade](https://meta.discourse.org/u/RobMeade)
#### Post date: [September 11, 2017, 5:39pm UTC](https://meta.discourse.org/t/watched-words-triggered-when-editing-old-posts/69355/8 "2017-09-11T17:39:51Z")

</div>

Hi @neil,

That explains why my reproduction didn’t quite work then. The original posts were posted by other people, non staff, so the steps I posted were not _exactly_ the same as the first time around - the different behaviour between staff / non-staff only became apparent as I was writing the steps - sorry.

I have had an opportunity to resolve one of these this evening and no duplicate flags appear to have been raised - needless to say I am a little confused, it most certainly did before because I recall editing four previously posted posts, asterisking the words, and then four flags appearing for those posts - this wouldn’t have been something that was cached because this was me _searching_ for the posts in the first place that may contain the specific words. The only wording that was on the watched words was in the _history_ for each post after I had submitted the edited version.

I am at a loss as to why this isn’t happening at the moment?

Any thoughts with regards to the related issue I mentioned too - regarding the images?

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [September 11, 2017, 6:40pm UTC](https://meta.discourse.org/t/watched-words-triggered-when-editing-old-posts/69355/9 "2017-09-11T18:40:28Z")

</div>

I had been testing on posts made by trust level 0 and 1 users, but was also unable to recreate the problem.

As for the uploads, it sounds like the words are introduced after processing the uploads.

---

<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: [September 11, 2017, 9:28pm UTC](https://meta.discourse.org/t/watched-words-triggered-when-editing-old-posts/69355/10 "2017-09-11T21:28:42Z")

</div>


