mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 08:49:06 +08:00
FIX: Ensure auto close notice is posted with system locale
Previously it was created with the locale of the user who created the final post in the topic
This commit is contained in:
parent
c164e9bbe0
commit
0a5376084d
|
@ -351,7 +351,8 @@ class PostCreator
|
|||
:closed, true, Discourse.system_user,
|
||||
message: I18n.t(
|
||||
'topic_statuses.autoclosed_message_max_posts',
|
||||
count: SiteSetting.auto_close_messages_post_count
|
||||
count: SiteSetting.auto_close_messages_post_count,
|
||||
locale: SiteSetting.default_locale
|
||||
)
|
||||
)
|
||||
elsif !is_private_message &&
|
||||
|
@ -363,7 +364,8 @@ class PostCreator
|
|||
:closed, true, Discourse.system_user,
|
||||
message: I18n.t(
|
||||
'topic_statuses.autoclosed_topic_max_posts',
|
||||
count: SiteSetting.auto_close_topics_post_count
|
||||
count: SiteSetting.auto_close_topics_post_count,
|
||||
locale: SiteSetting.default_locale
|
||||
)
|
||||
)
|
||||
end
|
||||
|
|
|
@ -391,6 +391,26 @@ describe PostCreator do
|
|||
expect(topic.closed).to eq(true)
|
||||
expect(topic_timer.reload.deleted_at).to eq_time(Time.zone.now)
|
||||
end
|
||||
|
||||
it "uses the system locale for the message" do
|
||||
post
|
||||
|
||||
I18n.with_locale(:fr) do
|
||||
PostCreator.new(
|
||||
topic.user,
|
||||
topic_id: topic.id,
|
||||
raw: "this is a second post"
|
||||
).create
|
||||
end
|
||||
|
||||
topic.reload
|
||||
|
||||
expect(topic.posts.last.raw).to eq(I18n.t(
|
||||
'topic_statuses.autoclosed_topic_max_posts',
|
||||
count: SiteSetting.auto_close_topics_post_count,
|
||||
locale: :en
|
||||
))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user