Profanity Filter - Not Working on Titles/Topic Subject Line

AI-generated summary

Users are discussing issues with the profanity filter not working on topic titles. BCHK and sethd report problems with profanity and spam in titles. codinghorror and codinghorror suggest using the official Akismet plugin to prevent spam.

AmiAthena points out that profanity should not be visible in titles if it is filtered in posts. tgxworld confirms this and submits a PR to fix the issue. However, tgxworld later realizes that the fix was too simple and proposes adding validation to disallow censored words in titles. riking and codinghorror agree with this approach, suggesting that the validation should only trigger when the title is changed. tgxworld eventually adds the validation on topic titles.

We’ve been having a problem recently with people posting profanity in the subject line/ topic title. It seems like the profanity filter should be working on that text also…

2 Likes

So tempted to edit this title…

7 Likes

I am having the same problem. I’m not trying to censor profanity but prevent this phone number this spammer keeps posting on our forum from being used. I am using the Akismet plugin but some amount of spam still gets through every night. Since the spammer has only used two different phone numbers in the entire time they have been spamming, I figured censored words would be an easy way to set them back. However, they just keep posting all of the information in the title of the topic and fill up the body with just random characters.

1 Like

You’re using the wrong approach – censored words is not to prevent spam. Try the official Akismet plugin.

2 Likes

Regardless of the spam issues, should profanity be showing up in titles if it’s filtered in the actual posts?

@AmiAthena It shouldn’t. I had a brief look into the code base and this is because the censored words preprocessor is only applied to the body of the posts.

2 Likes

PR submitted

https://github.com/discourse/discourse/pull/3692

2 Likes

@zogstrip Lets close this? :smile:

3 Likes

I just realized my fix was too simple. The censored words are still appearing in the title meta tag, links to the topic. I think the better way is to add a validation that disallow any censored words in the title. Any thoughts?

2 Likes

Make sure that it only triggers when the title is changed, otherwise scheduled tasks that touch old topics containing disallowed words will raise an exception.

3 Likes

Yes, we should do this, bearing in mind @riking’s caveat..

4 Likes

Finally got around to adding a validation on the topic tittle

https://github.com/discourse/discourse/commit/3d21ccd4a56d91bd6ba095debbe7a658d6a19d62

6 Likes