Hashtag linked categories do not show up properly in the composer

AI-generated summary

Issue: Hashtag linked categories not displaying properly in the composer.

GaurangTandon reported that some hashtag links appear non-clickable in the composer, despite working fine after submitting the post. They provided an image demo and noted the difference in HTML classes between working and non-working links: class="hashtag" vs class="hashtag hashtag-tested tag-hashtag-tested".

GaurangTandon shared relevant files from the Discourse GitHub repository, which helped identify the issue.

tgxworld investigated and found that the problem was due to category slugs being case sensitive, while the query was not. They fixed the issue in this commit.

 #javascript

JS - 1. Getting Started ...
 #javascript:getting-started-v2 

JS - 2. Code your own adventure
 #javascript:javascript-beginner-en-x9DnD 

JS - 3. Intro to Functions
 #javascript:javascript-beginner-en-6LzGd 

JS - 4. RPS
 #javascript:javascript-beginner-en-Bthev-mskY8

(works only in the codecademy site, but you might get the idea)

In the composer, not all of these links look live. After you submit the post they appear fine. If you go back into the composer they will not look live again.

The ones that aren’t showing as live have this class (in the composer):

class="hashtag hashtag-tested tag-hashtag-tested"

The ones that do show live have:

class="hashtag"

This is an image demo:

Note that only the first two are showing live (clickable). But when you submit the post, they all appear live.

This is the relevant JavaScript category over those forums, if it’s needed.


Credits to @AlbionsRefuge for the initial draft :slight_smile:

2 Likes

I got the relevant files after some manual digging. They are these three:

The following file adds the "hashtag-tested" class:

Now, it should be probably easy to find the bug.

2 Likes

I’ll have a look next week.

2 Likes

Thanks for reporting @GaurangTandon :slight_smile: Turns out category slugs are case sensitive but my query wasn’t.

Fixed in
https://github.com/discourse/discourse/commit/6d64b6d39f864947ea1fa52985dc669cd324c481

4 Likes