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:
parent
1ec46e3efd
commit
06f02ce9fc
7 changed files with 25 additions and 24 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue