Remove single alias/implication requests.

* Remove the single alias and implication request forms. From now
  on, bulk update requests are the only way to request aliases or
  implications.

* Remove the forum topic ID field from the bulk update request form.
  Instead, to attach a BUR to an existing topic you go to the topic then
  you click "Request alias/implication" at the top of the page.

* Update the bulk update request form to give better examples for the
  script format and to explain the difference between aliases and
  implications.
This commit is contained in:
evazion
2019-10-28 00:38:58 -05:00
parent b5a40aa233
commit dfbf4f3f0a
20 changed files with 48 additions and 418 deletions

View File

@@ -1,56 +0,0 @@
require 'test_helper'
class TagAliasRequestTest < ActiveSupport::TestCase
context "A tag alias request" do
setup do
@user = FactoryBot.create(:user)
CurrentUser.user = @user
CurrentUser.ip_addr = "127.0.0.1"
end
teardown do
CurrentUser.user = nil
CurrentUser.ip_addr = nil
end
should "handle invalid attributes" do
tar = TagAliasRequest.new(:antecedent_name => "", :consequent_name => "", :reason => "reason", :skip_secondary_validations => true)
tar.create
assert(tar.invalid?)
end
should "handle secondary validations" do
tar = TagAliasRequest.new(:antecedent_name => "aaa", :consequent_name => "bbb", :reason => "reason", :skip_secondary_validations => false)
tar.create
assert(tar.invalid?)
end
should "create a tag alias" do
assert_difference("TagAlias.count", 1) do
tar = TagAliasRequest.new(:antecedent_name => "aaa", :consequent_name => "bbb", :reason => "reason", :skip_secondary_validations => true)
tar.create
end
assert_equal("pending", TagAlias.last.status)
end
should "create a forum topic" do
assert_difference("ForumTopic.count", 1) do
tar = TagAliasRequest.new(:antecedent_name => "aaa", :consequent_name => "bbb", :reason => "reason", :skip_secondary_validations => true)
tar.create
end
end
should "create a forum post" do
assert_difference("ForumPost.count", 1) do
tar = TagAliasRequest.new(:antecedent_name => "aaa", :consequent_name => "bbb", :reason => "reason", :skip_secondary_validations => true)
tar.create
end
end
should "save the forum post id" do
tar = TagAliasRequest.new(:antecedent_name => "aaa", :consequent_name => "bbb", :reason => "reason", :skip_secondary_validations => true)
tar.create
assert_equal(tar.forum_topic.posts.first.id, tar.tag_alias.forum_post.id)
end
end
end

View File

@@ -204,7 +204,7 @@ class TagAliasTest < ActiveSupport::TestCase
setup do
@admin = FactoryBot.create(:admin_user)
CurrentUser.scoped(@admin) do
@topic = FactoryBot.create(:forum_topic, :title => TagAliasRequest.topic_title("aaa", "bbb"))
@topic = FactoryBot.create(:forum_topic, :title => "Tag alias: aaa -> bbb")
@post = FactoryBot.create(:forum_post, :topic_id => @topic.id, :body => TagAliasRequest.command_string("aaa", "bbb"))
@alias = FactoryBot.create(:tag_alias, :antecedent_name => "aaa", :consequent_name => "bbb", :forum_topic => @topic, :forum_post => @post, :status => "pending")
end

View File

@@ -1,50 +0,0 @@
require 'test_helper'
class TagImplicationRequestTest < ActiveSupport::TestCase
context "A tag implication request" do
setup do
@user = FactoryBot.create(:user)
CurrentUser.user = @user
CurrentUser.ip_addr = "127.0.0.1"
end
teardown do
CurrentUser.user = nil
CurrentUser.ip_addr = nil
end
should "handle invalid attributes" do
tir = TagImplicationRequest.new(:antecedent_name => "", :consequent_name => "", :reason => "reason", :skip_secondary_validations => true)
tir.create
assert(tir.invalid?)
end
should "handle secondary validations" do
tir = TagImplicationRequest.new(:antecedent_name => "aaa", :consequent_name => "bbb", :reason => "reason", :skip_secondary_validations => false)
tir.create
assert(tir.invalid?)
end
should "create a tag implication" do
assert_difference("TagImplication.count", 1) do
tir = TagImplicationRequest.new(:antecedent_name => "aaa", :consequent_name => "bbb", :reason => "reason", :skip_secondary_validations => true)
tir.create
end
assert_equal("pending", TagImplication.last.status)
end
should "create a forum topic" do
assert_difference("ForumTopic.count", 1) do
tir = TagImplicationRequest.new(:antecedent_name => "aaa", :consequent_name => "bbb", :reason => "reason", :skip_secondary_validations => true)
tir.create
end
end
should "create a forum post" do
assert_difference("ForumPost.count", 1) do
tir = TagImplicationRequest.new(:antecedent_name => "aaa", :consequent_name => "bbb", :reason => "reason", :skip_secondary_validations => true)
tir.create
end
end
end
end

View File

@@ -264,7 +264,7 @@ class TagImplicationTest < ActiveSupport::TestCase
context "with an associated forum topic" do
setup do
@admin = FactoryBot.create(:admin_user)
@topic = FactoryBot.create(:forum_topic, :title => TagImplicationRequest.topic_title("aaa", "bbb"))
@topic = FactoryBot.create(:forum_topic, :title => "Tag implication: aaa -> bbb")
@post = FactoryBot.create(:forum_post, topic_id: @topic.id, :body => TagImplicationRequest.command_string("aaa", "bbb"))
@implication = FactoryBot.create(:tag_implication, :antecedent_name => "aaa", :consequent_name => "bbb", :forum_topic => @topic, :forum_post => @post, :status => "pending")
end