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.
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.
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.
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.
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?
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.
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.
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…
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.
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?