Fix the build.

This commit is contained in:
Guo Xiang Tan 2018-07-10 09:48:57 +08:00
parent 10bc69a62f
commit 5374a0e720
2 changed files with 11 additions and 5 deletions

View File

@ -912,8 +912,14 @@ class Topic < ActiveRecord::Base
post_mover = PostMover.new(self, moved_by, post_ids)
if opts[:destination_topic_id]
post_mover.to_topic opts[:destination_topic_id]
DiscourseEvent.trigger(:topic_merged, post_mover.original_topic, post_mover.destination_topic)
topic = post_mover.to_topic(opts[:destination_topic_id])
DiscourseEvent.trigger(:topic_merged,
post_mover.original_topic,
post_mover.destination_topic
)
topic
elsif opts[:title]
post_mover.to_new_topic(opts[:title], opts[:category_id], opts[:tags])
end

View File

@ -201,11 +201,11 @@ RSpec.describe TopicsController do
expect(result['success']).to eq(true)
expect(result['url']).to be_present
end
it "triggers an event on merge" do
DiscourseEvent.on(:topic_merged) do |original_topic, destination_topic|
expect(original_topic.id).to eq(topic.id)
expect(destination_topic.id).to eq(dest_topic.id)
expect(original_topic).to eq(topic)
expect(destination_topic).to eq(dest_topic)
end
end
end