Censored links still work?

How can I automatically censor specific links in new posts?

The best solution for me would be censoring links. But the current “Censor” function hides only visible text and the link is working as if it wasn’t censored.

And when onebox is activated then Cersoring doesn’t work completely - nothing is hidden.

I’d like to hide not only text but destroy the link by changing it with my text. E.x. link “http://google.com/results…” would be censored to “http://blocked.com/results…” or “blocked link”

Any ideas on how to solve it?

Change min trust to post links to 1?

1 Like

Thanks, Jay! But the idea is to auto change censored words and links. That’s strange that Discourse censors words in plain text and doesn’t change URL addresses.

1 Like

Out of curiosity, if you have community members that are in the habit of “Spamming” links that are inappropriate for your community, why are they still members of your community? On the surface, this seems more like a moderation issue…

2 Likes

We do moderation but it takes time and is manual work.

I’d like to use a regex pattern to destroy specific links. Can anybody help me to construct a regex pattern for a link like this?
[text phrases](link to any page on a specific domain)

In my case [text phrases] may have different text versions and I would leave it original.

I need to hide only this part: (link to a page on a specific domain) where the domain is always the same, but the length and text of the link may be different.

The result should be like this:
[text phrases]■■■■■■■■■■■■■■■■■■■■■■■■

I found the topic, that previously censor function worked the way I need, but lately was changed: Censored words out of a URL

@riking > repro:

  1. add adf.ly to censored words list
  2. post with http://adf.ly/SpONsoREDliNK
  3. post renders with <a href="http://■■■■■■/SpONsoREDliNK">http://■■■■■■/SpONsoREDliNK</a>

@sam

The censor only applies to text now per:
https://github.com/discourse/discourse/blob/master/app/assets/javascripts/pretty-text/engines/markdown-it/censored.js.es6#L18-L22

1 Like

Created a regex pattern
(\[.*?\])\(https?://((www\.site\.com)).*/?\)

When I test it in “Test ‘Censor’ Watched Words”, the system finds the necessary part.
But it doesn’t work when I add the text to be replaced in the post.
What may cause it?

Another problem is that there is a restriction of the expression length - no more than 50 characters. Is it possible to increase it?

The easiest way to address the problem is to switch to blocking instead of censor.

The intention of censor is to prevent the visual display of “bad words”, not to break links, so that’s not what the feature is designed to do…

2 Likes