FIX: Use default locale for moderator post when posts are moved
This commit is contained in:
parent
f698de0bbf
commit
efef422416
|
@ -154,11 +154,14 @@ class PostMover
|
|||
def create_moderator_post_in_original_topic
|
||||
move_type_str = PostMover.move_types[@move_type].to_s
|
||||
|
||||
original_topic.add_moderator_post(
|
||||
user,
|
||||
message = I18n.with_locale(SiteSetting.default_locale) do
|
||||
I18n.t("move_posts.#{move_type_str}_moderator_post",
|
||||
count: post_ids.count,
|
||||
topic_link: "[#{destination_topic.title}](#{destination_topic.relative_url})"),
|
||||
topic_link: "[#{destination_topic.title}](#{destination_topic.relative_url})")
|
||||
end
|
||||
|
||||
original_topic.add_moderator_post(
|
||||
user, message,
|
||||
post_type: Post.types[:small_action],
|
||||
action_code: "split_topic",
|
||||
post_number: @first_post_number_moved
|
||||
|
|
|
@ -232,6 +232,21 @@ describe PostMover do
|
|||
|
||||
expect(new_topic.posts.pluck(:id).sort).to eq([p2.id, p3.id].sort)
|
||||
end
|
||||
|
||||
it "uses default locale for moderator post" do
|
||||
I18n.locale = 'de'
|
||||
|
||||
new_topic = topic.move_posts(user, [p2.id, p4.id], title: "new testing topic name", category_id: category.id)
|
||||
post = Post.find_by(topic_id: topic.id, post_type: Post.types[:small_action])
|
||||
|
||||
expected_text = I18n.with_locale(:en) do
|
||||
I18n.t("move_posts.new_topic_moderator_post",
|
||||
count: 2,
|
||||
topic_link: "[#{new_topic.title}](#{new_topic.relative_url})")
|
||||
end
|
||||
|
||||
expect(post.raw).to eq(expected_text)
|
||||
end
|
||||
end
|
||||
|
||||
context "to an existing topic" do
|
||||
|
|
Loading…
Reference in New Issue