mirror of
https://github.com/discourse/discourse.git
synced 2025-01-31 16:01:02 +08:00
Remove the colon from the poll prefix, drop regex support.
This is needed to make it possible to programmatically toggle between open and closed polls.
This commit is contained in:
parent
edbbf7ffbb
commit
2928ce6ca1
|
@ -13,5 +13,5 @@ en:
|
|||
must_contain_poll_options: "must contain a list of poll options"
|
||||
cannot_have_modified_options: "cannot be modified after the first five minutes. Contact a moderator if you need to change them."
|
||||
cannot_add_or_remove_options: "can only be edited, not added or removed. If you need to add or remove options you should lock this topic and create a new one."
|
||||
prefix: "Poll:"
|
||||
closed_prefix: "Closed Poll:"
|
||||
prefix: "Poll"
|
||||
closed_prefix: "Closed Poll"
|
||||
|
|
|
@ -13,5 +13,5 @@ es:
|
|||
must_contain_poll_options: "debe que contener una lista con las respuestas de la encuesta"
|
||||
cannot_have_modified_options: "no se pueden modificar las respuestas de la encuesta pasados 5 minutos"
|
||||
cannot_add_or_remove_options: "solo se puede modificar, no se pueden añadir o quitar. Si necesitas añadir o quitar respuestas debes bloquear este tema y crear una encuesta nueva."
|
||||
prefix: "Encuesta:"
|
||||
closed_prefix: "Encuesta Cerrada:"
|
||||
prefix: "Encuesta"
|
||||
closed_prefix: "Encuesta Cerrada"
|
||||
|
|
|
@ -19,5 +19,5 @@ fr:
|
|||
must_contain_poll_options: "doit contenir une liste d'options pour le sondage"
|
||||
cannot_have_modified_options: "ne peuvent pas être modifiés après 5 minutes. Merci de contacter un moderateur, si vous souhaitez les modifier"
|
||||
cannot_add_or_remove_options: "peuvent seulement être modifiés. Si vous souhaitez en supprimer ou en ajouter, veuillez créer un nouveau sujet."
|
||||
prefix: "Sondage\\s?:"
|
||||
closed_prefix: "Sondage fermé\\s?:"
|
||||
prefix: "Sondage "
|
||||
closed_prefix: "Sondage fermé "
|
||||
|
|
|
@ -13,5 +13,5 @@ it:
|
|||
must_contain_poll_options: "deve contenere una lista di opzioni per il sondaggio"
|
||||
cannot_have_modified_options: "non possono essere modificate dopo i primi cinque minuti. Contatta un moderatore se hai bisogno di cambiarle."
|
||||
cannot_add_or_remove_options: "non possono essere modificate, aggiunte o rimosse. Se vuoi aggiungere o rimuovere opzioni al sondaggio, devi bloccare questo topice crearne uno nuovo."
|
||||
prefix: "Sondaggio:"
|
||||
closed_prefix: "Sondaggio Chiuso:"
|
||||
prefix: "Sondaggio"
|
||||
closed_prefix: "Sondaggio Chiuso"
|
||||
|
|
|
@ -21,7 +21,7 @@ module ::PollPlugin
|
|||
return false
|
||||
end
|
||||
|
||||
topic.title =~ /^(#{I18n.t('poll.prefix')}|#{I18n.t('poll.closed_prefix')})/i
|
||||
topic.title =~ /^(#{I18n.t('poll.prefix').strip}|#{I18n.t('poll.closed_prefix').strip})\s?:/i
|
||||
end
|
||||
|
||||
def has_poll_details?
|
||||
|
|
|
@ -14,12 +14,12 @@ describe PollPlugin::Poll do
|
|||
expect(poll.is_poll?).to be_false
|
||||
end
|
||||
|
||||
it "allows the prefix translation to contain regular expressions" do
|
||||
topic.title = "Poll : This might be a poll"
|
||||
it "strips whitespace from the prefix translation" do
|
||||
topic.title = "Polll: This might be a poll"
|
||||
topic.save
|
||||
expect(PollPlugin::Poll.new(post).is_poll?).to be_false
|
||||
I18n.expects(:t).with('poll.prefix').returns("Poll\\s?:")
|
||||
I18n.expects(:t).with('poll.closed_prefix').returns("Closed Poll\\s?:")
|
||||
I18n.expects(:t).with('poll.prefix').returns("Polll ")
|
||||
I18n.expects(:t).with('poll.closed_prefix').returns("Closed Poll ")
|
||||
expect(PollPlugin::Poll.new(post).is_poll?).to be_true
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user