aliases: fix bug when trying to move wiki pages.
This commit is contained in:
@@ -150,7 +150,7 @@ class TagAlias < TagRelationship
|
||||
antecedent_wiki = WikiPage.titled(antecedent_name).first
|
||||
if antecedent_wiki.present?
|
||||
if WikiPage.titled(consequent_name).blank?
|
||||
antecedent_wiki.update!(title: consequent_name, skip_secondary_validations: true)
|
||||
antecedent_wiki.update!(title: consequent_name)
|
||||
else
|
||||
forum_updater.update(conflict_message)
|
||||
end
|
||||
|
||||
@@ -160,6 +160,16 @@ class TagAliasTest < ActiveSupport::TestCase
|
||||
end
|
||||
end
|
||||
|
||||
should "move existing wikis" do
|
||||
wiki = create(:wiki_page, title: "aaa")
|
||||
ta = create(:tag_alias, antecedent_name: "aaa", consequent_name: "bbb", status: "pending")
|
||||
|
||||
ta.approve!(approver: @admin)
|
||||
perform_enqueued_jobs
|
||||
|
||||
assert_equal("bbb", wiki.reload.title)
|
||||
end
|
||||
|
||||
should "move existing aliases" do
|
||||
ta1 = FactoryBot.create(:tag_alias, :antecedent_name => "aaa", :consequent_name => "bbb", :status => "pending")
|
||||
ta2 = FactoryBot.create(:tag_alias, :antecedent_name => "bbb", :consequent_name => "ccc", :status => "pending")
|
||||
|
||||
Reference in New Issue
Block a user