Watch Words Vervangen - Link

AI-generated summary

In a bug report titled “Watch Words Replace - Link” under the “Bug” category with tag “watched-words”, Heliosurge reports an issue where users receive a false warning about duplicate links when the system auto-replaces watched words — a feature replacing text with links. sam acknowledges it as an edge case worth fixing. nbianca confirms a fix was implemented via PR #14742. Heliosurge also notes a secondary issue: watched word replacements incorrectly altering parts of usernames (e.g., @pimaxquorra becomes a link). JammyDodger investigates and finds the issue may be resolved on “tests-passed” branch, citing PR #14260, but confirms the bug persists in “stable”. Heliosurge provides screenshots showing partial replacements in usernames. JammyDodger suggests enabling regular expressions with word boundaries (\b) to target exact matches, like \bsteam\b to avoid replacing “SteamVR”. Heliosurge confirms using simple word matching, not regex, and seeks exact-word targeting. nbianca identifies the root cause as regex being enabled and submits PR #14760 for a better fix. Heliosurge thanks the team and notes the need to wait for fixes to reach “stable”. JammyDodger clarifies that without regex, exact matching works automatically, and regex with \b boundaries can refine targeting. Heliosurge confirms testing on both branches: “stable” lacks regex support and requires \b syntax, while “tests-passed” works without it. JammyDodger notes the “Watched Words” revamp includes useful tweaks pending stable rollout. Heliosurge expresses excitement for upcoming features on “tests-passed” but notes main site remains on “stable”.

Hi I have recently used Watch Words Replace function as the old theme component Linkify words

This works great. However I have been notified by a user he receives a warning nag pop up that the link has already been used in a topic. As the member is not posting.a link. It is a system function. The user should not have this inconvenience.

4 likes

Oh, this is a very interesting edge case. I support improving this.

2 likes

Thank you for the bug report. A fix for this edge case was implemented in this PR:

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

4 likes

Your welcome and thanks for the speedy fix.

:clinking_beer_mugs::smiling_face_with_sunglasses::+1::sparkles:

Only other minor issue I had found is that if a word link replacement is part of a username the @mention part of there name is replaced with link.

1 like

I think that has been fixed recently?

Update

I’ve just checked on my test site, and while it shows a match&replace in the test box, in a ‘real’ post it does not make the replacement. (watched word to replace = *one)

1 like

It mist be very recent as I had to disable 1 link.

Will test and let you know. Thanks.

1 like

Okay here is my test after implementing lnk for pimax. User pimaxquorra part of his name is replaced with lnk

Running Stable

1 like

Ah, that may be why. I’m on tests-passed, and that one gets more frequent updates.

Though I notice that your link only targets a portion of the username/word rather than the whole lot as mine did. I wonder if you’ve also got ‘watched words are regular expressions’ set as well? That may have an effect.

1 like

In setting i have it as follows

Watched Word: pimax

Replace is the Link.

Is there a way to have the argument only Target the word alone?

Ie ‘pimax’ = lnk replacement
‘pimaxes’ = no replace as it has extra

Same with usernanes ir other compound or hyvenated words.

I have Steam setup as a link and with SteamVR it replaces the Steam part of SteamVR as a link.

1 like

I realized that the problem was when watched_words_regular_expression was enabled. I think I have a better fix for this problem in place and it will be available in tests-passed once the PR is merged:

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

4 likes

Awesome. Though will need to wait for these to roll out to stable.

Thanks very responsive and speedy with fixes.

:clinking_beer_mugs::smiling_face_with_sunglasses::+1::sparkles:

1 like

Without watched words regular expressions set it actually does that automatically. I had to add wildcards * to catch a word that was part of a username/longer word.

With the regular expressions you can do it with boundaries (\b). So \bsteam\b would only catch ‘steam’ and not ‘steamVR’ or ‘somethingsteam’.

I can replicate the partial substitution if I have watched words regular expressions set in the admin settings, so it may be worth a check?

1 like

Okay checked in both Stable and Tests passed.

Stable only has Replace no separate link setting in Watched Words.

With or without regular expression turned on the replace watched words doesn’t work with the /bword/b. In fact you need to add the /bword/b for word to be recognized instead of just word

Test Passed works without needing the /bword/b in Link watched words.

So looks like just need to wait for Tests Passed to roll out to Stable.

1 like

Ah, I thought it was only the @mentions fix you were missing. Oh well, the Watched Words revamp sounds like it’s got a few useful tweaks for you when you get it. :slightly_smiling_face: Hopefully it won’t be long. :crossed_fingers:

1 like

Indeed can play with some of the new stuff on our test passed testing server. Unfortunately our main is using stable. There are a number of improvements that I can’t wait to be available on stable branch. :star_struck:

1 like

This topic was automatically closed after 2 days. New replies are no longer allowed.