Add ability to mark tags as deprecated

* Deprecated tags can't be added to posts, but existing deprecated tags
  in a post won't be removed
* Only empty tags can be marked as deprecated manually
* No tags can be manually undeprecated
** These limits don't apply to admins
* Deprecating or undeprecating a tag will create a new mod action to
  prevent people from going rogue
* Added deprecate/undeprecate commands for BURs
* Deprecating a tag via BUR removes all implications to and from it as well
This commit is contained in:
nonamethanks
2022-04-08 00:51:53 +02:00
parent 98a9b2484b
commit ea76a889db
16 changed files with 194 additions and 5 deletions

View File

@@ -479,6 +479,23 @@ class PostTest < ActiveSupport::TestCase
end
end
context "tagged with a deprecated tag" do
should "not remove the tag if the tag was already in the post" do
bad_tag = create(:tag, name: "bad_tag")
old_post = FactoryBot.create(:post, tag_string: "bad_tag")
bad_tag.update!(is_deprecated: true)
old_post.update!(tag_string: "asd bad_tag")
assert_equal("asd bad_tag", old_post.reload.tag_string)
end
should "not add the tag if it is being added" do
create(:tag, name: "a_bad_tag", is_deprecated: true)
@post.update!(tag_string: "asd a_bad_tag")
assert_equal("asd", @post.reload.tag_string)
end
end
context "tagged with a metatag" do
context "for typing a tag" do
setup do