Category allowed tags do not reload with category change


(Rafal Likitarczuk) #1

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


(Jeff Atwood) #2

Can you repro this @jomaxro


(Joshua Rosenfeld) #4

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.


(Rafal Likitarczuk) #5

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


(Joshua Rosenfeld) #6

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.


(Joffrey Jaffeux) #8

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.


(Rafal Likitarczuk) #9

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


(Joffrey Jaffeux) #10

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


(Joffrey Jaffeux) #11

Should be fixed by

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


(Kane York) #12

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?


(Jeff Atwood) #13

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


(Kane York) #14

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.


(Joffrey Jaffeux) #15

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.


(Sam Saffron) #16

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


(Joffrey Jaffeux) #17

So I will merge this today: FIX: do no reset tags selection on category selection by jjaffeux · Pull Request #6369 · discourse/discourse · GitHub 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.