Category allowed tags do not reload with category change

Hi Team!
I use different tags or tag groups allowed per category. It works fine if you start a new topic in a right category or choose your first category in a new topic. However once you switch to another category in a new topic window, allowed tags stay the same as for original (first chosen) category.

Example:

Looking forward your support on this.

Regards
Rafal

4 Likes

Can you repro this @jomaxro

2 Likes

Yep, can repro. Created 2 tag groups, each with 2 tags. I added a tag group restriction to 2 categories. Selecting the first category in the composer shows the correct allowed tags. Changing the category does not update the tags. I was able to select an unallowed tag and create the topic. The tag was silently removed upon creation, no error message.

1 Like

Good, so we have a confirmation.
What is usually a next step and a way to correct that?

Next step is that one of our engineers will be assigned to resolve this. Once they submit the fix, you simply update your site via /admin/upgrade and you’ll be all set.

2 Likes

I can give it a look. Clearing all tags when changing category should do it @codinghorror ? or do we want to go extra fancy and try to keep tags which would be allowed on this new category ? Probably doable, but the use case seems rare enough to not bother with the extra code.

1 Like

Thanks for clear info @jomaxro!
I guess that I will get this information about fix available in this post?

Yes watch this topic for updates, worst case should be next week.

3 Likes

Should be fixed by
https://github.com/discourse/discourse/commit/17087eff2a0c02b8108ccee0f6af42ed5ad6100e

I went the “easy” way of just nuking current tags when switching category.

6 Likes

This might be a bit punishing for sites with no tag-category restrictions - maybe check that at least one of (prev-category, new-category) has restrictions on it?

4 Likes

Maybe but really how often is this going to come up? Complaint Driven Development is preferable.

To clarify, we’re talking about the situation of someone writing a new topic, they pick a category and enter tags, write some stuff, then realize their category isn’t really the best and switch to a new one.
Oops! Tags are gone.

Right now, changing the category doesn’t destroy your tag input, and for sites without any restrictions on tags per category, that…makes a lot of sense.

5 Likes

Yes all of this is already stated above. This commit is “the easy way”, mostly because categories loaded come from category_list_serializer which doesn’t include allowed_tags and allowed_tag_groups.

I don’t disagree with what you say here as I asked about it sooner. What I disagree, is the frequency on which it would be an issue compared to changes involved.

-> tags are enabled
-> you need to use tags on this topic
-> change your category after setting tags
-> to a category with not tags restriction
-> and I would even say, have more than one tag, otherwise this is really not that much annoying

So I would want to first try to live with this and see if it’s an actual issue. If it’s an actual issue we can add this to category_list_serializer and check on allowed_tags before deciding to remove tags or not.

1 Like

I think an “ultra cheap” safeguard of … site has no tag groups so I don’t need this magic is a fine small step here we could take. But we can wait and see…

My giant concern here though is this dialog:

Recategorizing is super common and you have to obliterate tags there so this is not good at all ™

Personally I feel error on save is the easiest way to solve this

5 Likes

So I will merge this today: https://github.com/discourse/discourse/pull/6369 which essentially remove the reset tags on category selection.

And after release I will implement server side error handling to display a validation error in the composer, eg:
“Sorry you are not allowed tag ABC on category XYZ”

Today this validation is silent, so it’s still not a perfect solution, but very close to be IMO. We will still be showing tags we shouldn’t be showing but we make it very clear what the issue is, instead of removing magically (client or server side) which would lead to incomprehension.

6 Likes

Good discussion with those different scenarios and user’s behavior.
@joffreyjaffeux, in which stable release can we expect validation of tags and error handling message?

You can expect the new validation to be there in the next few months

4 Likes

I’m comming back after next few months (around 4th) with the same question - when can I expect this feature in stable release ? :grinning: Any estimates?

Look at the date it was posted and compare those days to #releases. For example 2.1 was released on September 10.

Yes I didn’t get to it yet, will try to get to it after 2.2 is released.