BURs: don't allow implying tags from different categories.

Don't allow requests for implications between tags of different
categories. For example, don't allow character tags to imply copyright
tags.
This commit is contained in:
evazion
2020-12-02 15:02:29 -06:00
parent 6275e85148
commit 4a4c198287
3 changed files with 20 additions and 0 deletions

View File

@@ -140,6 +140,18 @@ class BulkUpdateRequestTest < ActiveSupport::TestCase
assert_equal(false, @bur.valid?)
assert_equal(["Can't create implication a -> c (a already implies c through another implication)"], @bur.errors.full_messages)
end
should "fail for an implication between tags of different categories" do
create(:tag, name: "hatsune_miku", category: Tag.categories.character)
create(:tag, name: "vocaloid", category: Tag.categories.copyright)
create(:wiki_page, title: "hatsune_miku")
create(:wiki_page, title: "vocaloid")
@bur = build(:bulk_update_request, script: "imply hatsune_miku -> vocaloid")
assert_equal(false, @bur.valid?)
assert_equal(["Can't create implication hatsune_miku -> vocaloid (Can't imply a character tag to a copyright tag)"], @bur.errors.full_messages)
end
end
context "the remove alias command" do