Steps to reproduce
Log in as a wrangler
Find yourself an unwrangled tag, e.g. by going to the freeform bin: https://test.archiveofourown.org/tag_wranglings?show=freeforms
Follow the "Edit" link for the unwrangled tag you want to work with
Check the "Unwrangleable" box, but do not enter anything in the "Fandoms" field
Press "Save changes"
What happens
The tag is marked unwrangleable! It has also disappeared from any and all bins because there is no fandom attached.
What should happen
You should get an error message that says, "Sorry, you can't mark a tag unwrangleable until it has a fandom."
If the tag you're editing is a fandom, the Unwrangleable section of the form should just... not be there, because fandoms are never supposed to be marked unwrangleable. (For thoroughness, we probably want to add a backend check rather than just relying on the checkbox not appearing in the view. If you need an error message, that one can be, "Sorry, you can't mark a fandom unwrangleable.")
Qem:
Oh sure! This page here has a few:
https://test.archiveofourown.org/tags/Supernatural RPF/wrangle?show=freeforms&status=unwrangleable
So each fandom has character/relationship/freeform bins, and then you can switch statuses
and this will show pages of tags that are attached to that fandom with that status.
And in the right hand side near the “edit” button there’s a button you can tick with remove, and then hit the wrangle button to remove a tag from the fandom.
Thanks! I see what you mean now, and I can reproduce the behaviour as well.
I started looking at disabling that check box for unwrangleable tags, but that’s a UI fix. I think the tag model should prevent this, unless validations aren’t being applied here.
Update: The validations are being applied, since if I try to make the unwrangleable tag canonical by hacking the form I do see an error. The mystery deepens…
All right, I think it’s here: https://github.com/otwcode/otwarchive/blob/master/app/models/tag.rb#L804-L817
ActiveRecord touch skips validations (https://guides.rubyonrails.org/active_record_validations.html#skipping-validations)
We’re going to move the rest of this to a new issue and reply this fix as-is. New issue:
Everything seems to be working well: the unwrangled Tron tags (chars, rels and freeforms all tested) refused to become unwrangleable and the error message popped up at the top, and only disappeared after I added on the fandom.