2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-09 19:03:09 +08:00

FIX: 🈂️ Allow closing polls in multi-locale sites

This commit is contained in:
riking 2015-02-05 19:38:51 -08:00
parent 1ec46e3efd
commit 06f02ce9fc
7 changed files with 25 additions and 24 deletions

View file

@ -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