A platform for community discussion. Free, open, simple.
FIX: generate topic excerpt when moving posts to new topic.
Vinoth Kannan310952fd6a2f
diff --git a/app/models/post_mover.rb b/app/models/post_mover.rbindex 0e36834ac88..184fd3b9ee0 100644--- a/app/models/post_mover.rb+++ b/app/models/post_mover.rb@@ -49,6 +49,7 @@ class PostMoverDiscourseTagging.tag_topic_by_names(new_topic, Guardian.new(user), tags)move_posts_to new_topicwatch_new_topic+ update_topic_excerpt new_topicnew_topicendenqueue_jobs(topic)@@ -57,6 +58,10 @@ class PostMoverprivate+ def update_topic_excerpt(topic)+ topic.update_excerpt(topic.first_post.excerpt_for_topic)+ end+def move_posts_to(topic)Guardian.new(user).ensure_can_see! topic@destination_topic = topicdiff --git a/spec/requests/topics_controller_spec.rb b/spec/requests/topics_controller_spec.rbindex 6b93acbc026..311a7bf6125 100644--- a/spec/requests/topics_controller_spec.rb+++ b/spec/requests/topics_controller_spec.rb@@ -118,7 +118,10 @@ RSpec.describe TopicsController doresult = response.parsed_bodyexpect(result['success']).to eq(true)- expect(result['url']).to eq(Topic.last.relative_url)++ new_topic = Topic.last+ expect(result['url']).to eq(new_topic.relative_url)+ expect(new_topic.excerpt).to eq(p2.excerpt_for_topic)expect(Tag.all.pluck(:name)).to contain_exactly("tag1", "tag2")end