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:
@@ -1,25 +0,0 @@
|
||||
require 'test_helper'
|
||||
|
||||
class TagAliasRequestsControllerTest < ActionDispatch::IntegrationTest
|
||||
context "The tag alias request controller" do
|
||||
setup do
|
||||
@user = create(:user)
|
||||
end
|
||||
|
||||
context "new action" do
|
||||
should "render" do
|
||||
get_auth new_tag_alias_request_path, @user
|
||||
assert_response :success
|
||||
end
|
||||
end
|
||||
|
||||
context "create action" do
|
||||
should "render" do
|
||||
assert_difference("ForumTopic.count", 1) do
|
||||
post_auth tag_alias_request_path, @user, params: {:tag_alias_request => {:antecedent_name => "aaa", :consequent_name => "bbb", :reason => "ccc", :skip_secondary_validations => true}}
|
||||
end
|
||||
assert_redirected_to(forum_topic_path(ForumTopic.last))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,43 +0,0 @@
|
||||
require 'test_helper'
|
||||
|
||||
class TagImplicationRequestsControllerTest < ActionDispatch::IntegrationTest
|
||||
context "The tag implication request controller" do
|
||||
setup do
|
||||
travel_to(1.month.ago) do
|
||||
@user = create(:user)
|
||||
end
|
||||
end
|
||||
|
||||
context "new action" do
|
||||
should "render" do
|
||||
get_auth new_tag_implication_request_path, @user
|
||||
assert_response :success
|
||||
end
|
||||
end
|
||||
|
||||
context "create action" do
|
||||
should "create forum post" do
|
||||
assert_difference("ForumTopic.count", 1) do
|
||||
post_auth tag_implication_request_path, @user, params: {:tag_implication_request => {:antecedent_name => "aaa", :consequent_name => "bbb", :reason => "ccc", :skip_secondary_validations => true}}
|
||||
end
|
||||
assert_redirected_to(forum_topic_path(ForumTopic.last))
|
||||
end
|
||||
|
||||
should "create a pending implication" do
|
||||
params = {
|
||||
:tag_implication_request => {
|
||||
:antecedent_name => "foo",
|
||||
:consequent_name => "bar",
|
||||
:reason => "blah blah",
|
||||
:skip_secondary_validations => true
|
||||
}
|
||||
}
|
||||
|
||||
assert_difference("ForumTopic.count") do
|
||||
post_auth tag_implication_request_path, @user, params: params
|
||||
end
|
||||
assert_redirected_to(forum_topic_path(ForumTopic.last))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user