Fix #5013: BUR model doesn't validate tags.

Don't allow users to request aliases, implications, or renames for invalid tag names.

As a side effect, it's no longer possible to request shortcut aliases like
`/hr -> hakurei_reimu` (slash abbreviations still exist, but they can't
be overridden with aliases). Tests involving these types of aliases are
removed.
This commit is contained in:
evazion
2022-04-30 19:25:18 -05:00
parent 0920d2ca24
commit ccd0dde081
10 changed files with 66 additions and 31 deletions

View File

@@ -1276,12 +1276,11 @@ class PostQueryBuilderTest < ActiveSupport::TestCase
should "resolve abbreviations to the actual tag" do
tag1 = create(:tag, name: "hair_ribbon", post_count: 300_000)
tag2 = create(:tag, name: "hakurei_reimu", post_count: 50_000)
ta1 = create(:tag_alias, antecedent_name: "/hr", consequent_name: "hakurei_reimu")
post1 = create(:post, tag_string: "hair_ribbon")
post2 = create(:post, tag_string: "hakurei_reimu")
assert_tag_match([post2], "/hr")
assert_tag_match([post1], "-/hr")
assert_tag_match([post1], "/hr")
assert_tag_match([post2], "-/hr")
end
should "fail if the search exceeds the tag limit" do