mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 05:38:13 +08:00
FIX: 🈂️ Allow closing polls in multi-locale sites
This commit is contained in:
@ -80,10 +80,12 @@ after_initialize do
|
||||
end
|
||||
|
||||
# Modify topic title.
|
||||
if topic.title =~ /^(#{I18n.t('poll.prefix').strip})\s?:/i
|
||||
topic.title = topic.title.gsub(/^(#{I18n.t('poll.prefix').strip})\s?:/i, I18n.t('poll.closed_prefix') + ':')
|
||||
elsif topic.title =~ /^(#{I18n.t('poll.closed_prefix').strip})\s?:/i
|
||||
topic.title = topic.title.gsub(/^(#{I18n.t('poll.closed_prefix').strip})\s?:/i, I18n.t('poll.prefix') + ':')
|
||||
I18n.with_locale(topic.user.effective_locale) do
|
||||
if topic.title =~ /^(#{I18n.t('poll.prefix').strip})\s?:/i
|
||||
topic.title = topic.title.gsub(/^(#{I18n.t('poll.prefix').strip})\s?:/i, I18n.t('poll.closed_prefix') + ':')
|
||||
elsif topic.title =~ /^(#{I18n.t('poll.closed_prefix').strip})\s?:/i
|
||||
topic.title = topic.title.gsub(/^(#{I18n.t('poll.closed_prefix').strip})\s?:/i, I18n.t('poll.prefix') + ':')
|
||||
end
|
||||
end
|
||||
|
||||
topic.acting_user = current_user
|
||||
|
Reference in New Issue
Block a user