mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
UX: Moderator post wasn't completely translatable
This commit is contained in:
parent
04a63cfaaa
commit
66901f67f6
3 changed files with 25 additions and 6 deletions
|
@ -196,12 +196,12 @@ class PostMover
|
||||||
|
|
||||||
def create_moderator_post_in_original_topic
|
def create_moderator_post_in_original_topic
|
||||||
move_type_str = PostMover.move_types[@move_type].to_s
|
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
|
message = I18n.with_locale(SiteSetting.default_locale) do
|
||||||
I18n.t(
|
I18n.t(
|
||||||
"move_posts.#{move_type_str}_moderator_post",
|
"move_posts.#{move_type_str}_moderator_post",
|
||||||
count: posts.length,
|
count: posts.length,
|
||||||
entity: @move_to_pm ? "message" : "topic",
|
|
||||||
topic_link: posts.first.is_first_post? ?
|
topic_link: posts.first.is_first_post? ?
|
||||||
"[#{destination_topic.title}](#{destination_topic.relative_url})" :
|
"[#{destination_topic.title}](#{destination_topic.relative_url})" :
|
||||||
"[#{destination_topic.title}](#{posts.first.url})"
|
"[#{destination_topic.title}](#{posts.first.url})"
|
||||||
|
|
|
@ -2038,11 +2038,17 @@ en:
|
||||||
|
|
||||||
move_posts:
|
move_posts:
|
||||||
new_topic_moderator_post:
|
new_topic_moderator_post:
|
||||||
one: "A post was 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 %{entity}: %{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:
|
existing_topic_moderator_post:
|
||||||
one: "A post was 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 %{entity}: %{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:
|
change_owner:
|
||||||
post_revision_text: "Ownership transferred"
|
post_revision_text: "Ownership transferred"
|
||||||
|
|
|
@ -248,7 +248,6 @@ describe PostMover do
|
||||||
expected_text = I18n.with_locale(:en) do
|
expected_text = I18n.with_locale(:en) do
|
||||||
I18n.t("move_posts.new_topic_moderator_post",
|
I18n.t("move_posts.new_topic_moderator_post",
|
||||||
count: 2,
|
count: 2,
|
||||||
entity: "topic",
|
|
||||||
topic_link: "[#{new_topic.title}](#{new_topic.relative_url})")
|
topic_link: "[#{new_topic.title}](#{new_topic.relative_url})")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -660,6 +659,20 @@ describe PostMover do
|
||||||
expect(personal_message.closed).to eq(true)
|
expect(personal_message.closed).to eq(true)
|
||||||
expect(moved_to.posts_count).to eq(6)
|
expect(moved_to.posts_count).to eq(6)
|
||||||
end
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue