Tags show in tag menu even when they cannot exist in that category

This bug is in the context of tags that can only be used in a category or sub-category. In this exampleI have added a tag “testloungepublic” to the sub-category “Public” under the category “Lounge”.

As you might expect, when a post is added to this sub-category with the tag “testloungepublic” it does indeed show up in the tag list (but not until the tag is used). Clicking that tag takes you to a nicely bread-crumbed view of that tag under the sub-category. All good.

However, if I go to a completely different category that cannot host that tag, it will still show up in the tag menu. This is a bad affordance because, if clicked on, this tag can never have any posts in it.

I propose that the correct behaviour would be to hide the tags when there are no post it could show. Just as we hide the tag when the are no posts site wide. It seems that this behaviour is somewhat inconsistent.

2 Likes

Thanks for posting this @sampattuzzi. @codinghorror would be great for us if this could get some attention.

I’ve got a fix in progress.

https://github.com/discourse/discourse/pull/4315/files

It is getting late here so I will continue with the writing of tests tomorrow

2 Likes

You rock @tgxworld! Do you know how long it takes for these changes to filter down to the subscription product?

PR has been merged.

Usually within a week :slight_smile:

1 Like

That’s awesome. Can’t wait to see it working on our production site! :joy:

@tgxworld I finished the WIP. :slight_smile:

https://github.com/discourse/discourse/commit/304f7040a37ddbea7a46d23405a03e14d4e767ba

If some tags were restricted to a category, then the filter in all other categories would disappear.

7 Likes