UX: Moderator post wasn't completely translatable

UX: Moderator post wasn’t completely translatable

diff --git a/app/models/post_mover.rb b/app/models/post_mover.rb
index d8db5c6..47e8790 100644
--- a/app/models/post_mover.rb
+++ b/app/models/post_mover.rb
@@ -196,12 +196,12 @@ class PostMover
 
   def create_moderator_post_in_original_topic
     move_type_str = PostMover.move_types[@move_type].to_s
+    move_type_str.sub!("topic", "message") if @move_to_pm
 
     message = I18n.with_locale(SiteSetting.default_locale) do
       I18n.t(
         "move_posts.#{move_type_str}_moderator_post",
         count: posts.length,
-        entity: @move_to_pm ? "message" : "topic",
         topic_link: posts.first.is_first_post? ?
           "[#{destination_topic.title}](#{destination_topic.relative_url})" :
           "[#{destination_topic.title}](#{posts.first.url})"
diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml
index 74a049a..3f61910 100644
--- a/config/locales/server.en.yml
+++ b/config/locales/server.en.yml
@@ -2038,11 +2038,17 @@ en:
 
   move_posts:
     new_topic_moderator_post:
-      one: "A post was split to a new %{entity}: %{topic_link}"
-      other: "%{count} posts were split to a new %{entity}: %{topic_link}"
+      one: "A post was split to a new topic: %{topic_link}"
+      other: "%{count} posts were split to a new topic: %{topic_link}"
+    new_message_moderator_post:
+      one: "A post was split to a new message: %{topic_link}"
+      other: "%{count} posts were split to a new message: %{topic_link}"
     existing_topic_moderator_post:
-      one: "A post was merged into an existing %{entity}: %{topic_link}"
-      other: "%{count} posts were merged into an existing %{entity}: %{topic_link}"
+      one: "A post was merged into an existing topic: %{topic_link}"
+      other: "%{count} posts were merged into an existing topic: %{topic_link}"
+    existing_message_moderator_post:
+      one: "A post was merged into an existing message: %{topic_link}"
+      other: "%{count} posts were merged into an existing message: %{topic_link}"
 
   change_owner:
     post_revision_text: "Ownership transferred"
diff --git a/spec/models/post_mover_spec.rb b/spec/models/post_mover_spec.rb
index 3d7ec10..01dc7cf 100644
--- a/spec/models/post_mover_spec.rb
+++ b/spec/models/post_mover_spec.rb
@@ -248,7 +248,6 @@ describe PostMover do
             expected_text = I18n.with_locale(:en) do
               I18n.t("move_posts.new_topic_moderator_post",
                      count: 2,
-                     entity: "topic",
                      topic_link: "[#{new_topic.title}](#{new_topic.relative_url})")
             end
 
@@ -660,6 +659,20 @@ describe PostMover do
           expect(personal_message.closed).to eq(true)
           expect(moved_to.posts_count).to eq(6)
         end
+
+        it "uses the correct small action post" do
+          moved_to = personal_message.move_posts(admin, [p2.id], destination_topic_id: another_personal_message.id, archetype: "private_message")
+          post = Post.find_by(topic_id: personal_message.id, post_type: Post.types[:small_action])
+
+          expected_text = I18n.t(
+            "move_posts.existing_message_moderator_post",
+            count: 1,
+            topic_link: "[#{moved_to.title}](#{p2.reload.url})",
+            locale: :en
+          )
+
+          expect(post.raw).to eq(expected_text)
+        end
       end
     end
   end

GitHub sha: 66901f67

1 Like

This commit has been mentioned on Discourse Meta. There might be relevant details there:

This commit has been mentioned on Discourse Meta. There might be relevant details there: