mirror of
https://github.com/discourse/discourse.git
synced 2025-03-26 03:15:41 +08:00
FIX: poll plugin wasn't working when the OP was deleted
Alternatively fixes issue reported -> https://meta.discourse.org/t/bug-with-flag-as-spam/25359
This commit is contained in:
parent
fed9943d90
commit
f916087e81
@ -6,20 +6,16 @@ module ::PollPlugin
|
|||||||
end
|
end
|
||||||
|
|
||||||
def is_poll?
|
def is_poll?
|
||||||
if !@post.post_number.nil? and @post.post_number > 1
|
# Not a new post, and also not the first post.
|
||||||
# Not a new post, and also not the first post.
|
return false if @post.post_number.present? && @post.post_number > 1
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
topic = @post.topic
|
topic = @post.topic
|
||||||
|
|
||||||
# Topic is not set in a couple of cases in the Discourse test suite.
|
# Topic is not set in a couple of cases in the Discourse test suite.
|
||||||
return false if topic.nil?
|
return false if topic.nil? || topic.user.nil?
|
||||||
|
|
||||||
if @post.post_number.nil? and topic.highest_post_number > 0
|
# New post, but not the first post in the topic.
|
||||||
# New post, but not the first post in the topic.
|
return false if @post.post_number.nil? && topic.highest_post_number > 0
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
I18n.with_locale(topic.user.effective_locale) do
|
I18n.with_locale(topic.user.effective_locale) do
|
||||||
topic.title =~ /^(#{I18n.t('poll.prefix').strip}|#{I18n.t('poll.closed_prefix').strip})\s?:/i
|
topic.title =~ /^(#{I18n.t('poll.prefix').strip}|#{I18n.t('poll.closed_prefix').strip})\s?:/i
|
||||||
|
Loading…
x
Reference in New Issue
Block a user