diff --git a/app/assets/javascripts/discourse/templates/modal/merge_topic.js.handlebars b/app/assets/javascripts/discourse/templates/modal/merge_topic.js.handlebars index 2315325049c..137f6fa665a 100644 --- a/app/assets/javascripts/discourse/templates/modal/merge_topic.js.handlebars +++ b/app/assets/javascripts/discourse/templates/modal/merge_topic.js.handlebars @@ -5,7 +5,6 @@ {{/if}} - {{selectedPostsCount}}

{{{i18n topic.merge_topic.instructions count="selectedPostsCount"}}}

{{chooseTopic selectedTopicId=selectedTopicId}} diff --git a/app/models/post_mover.rb b/app/models/post_mover.rb index 11f15de3043..ff930738a9a 100644 --- a/app/models/post_mover.rb +++ b/app/models/post_mover.rb @@ -1,6 +1,10 @@ class PostMover attr_reader :original_topic, :destination_topic, :user, :post_ids + def self.move_types + @move_types ||= Enum.new(:new_topic, :existing_topic) + end + def initialize(original_topic, user, post_ids) @original_topic = original_topic @user = user @@ -8,12 +12,16 @@ class PostMover end def to_topic(id) + @move_type = PostMover.move_types[:existing_topic] + Topic.transaction do move_posts_to Topic.find_by_id(id) end end def to_new_topic(title) + @move_type = PostMover.move_types[:new_topic] + Topic.transaction do move_posts_to Topic.create!( user: user, @@ -94,11 +102,9 @@ class PostMover def create_moderator_post_in_original_topic original_topic.add_moderator_post( user, - I18n.t( - "move_posts.moderator_post", - count: post_ids.count, - topic_link: "[#{destination_topic.title}](#{destination_topic.url})" - ), + I18n.t("move_posts.#{PostMover.move_types[@move_type].to_s}_moderator_post", + count: post_ids.count, + topic_link: "[#{destination_topic.title}](#{destination_topic.url})"), post_number: @first_post_number_moved ) end diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index 83bfac2cde0..b7d6d51aa82 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -661,9 +661,12 @@ en: frequent_poster: "Frequent Poster" move_posts: - moderator_post: + new_topic_moderator_post: one: "I moved a post to a new topic: %{topic_link}" other: "I moved %{count} posts to a new topic: %{topic_link}" + existing_topic_moderator_post: + one: "I moved a post to an existing topic: %{topic_link}" + other: "I moved %{count} posts to an existing topic: %{topic_link}" topic_statuses: archived_enabled: "This topic is now archived. It is frozen and cannot be changed in any way."