Using a tag in multiple tag groups with parent

I have a situation where I need to use the same tag in multiple tag groups that use parent tags, it is possible to add the tag to multiple groups, but then when I select the parent tag, the child tag that is in that group does not show up in the list. This is a bit hard to explain so here’s an example:

Parent-tag-1
unique-child-tag-1
common-tag
Parent-tag-2
unique-child-tag-2
common-tag

So when I have common-tag in both parent tag groups, the common-tag does not show in the tag selector after I select either parent tags, if I remove the common tag from one of the groups, it will show in the other.

Is this intended behavior? I can’t see a reason why you shouldn’t be able to use the common tag with each parent tag, but maybe it is too complex to make it work this way.

3 Likes

@neil is probably best to answer this. He’s done the most work with tags and groups.

5 Likes

That’s a bug. It should be returning the common-tag for both parent tags. I’ll work on a fix.

4 Likes

Fixed. Thanks for reporting it.

https://github.com/discourse/discourse/commit/5ef49692e08fdb57e89042810cda9497c1f3be04

4 Likes

Thanks Neil, this fixed it for most scenarios, but I still have the issue. It took some experimenting but I finally figured out why. The parent tags are in a tag group, if I have Limit one tag per topic from this group turned on, then the common tag will not show up.

1 Like

I tried to support this, but couldn’t come up with a solution. It might take a while to solve this (and any other future tag features) without looking at how to redo the filter_allowed_tags nightmare method. Implementing everything in one giant SQL statement is not working anymore.

6 Likes

@davidkingham I was able to fix that bug after a bit of a rewrite of that code.

5 Likes