mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 15:48:43 -05: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
1 changed files with 5 additions and 9 deletions
|
@ -6,20 +6,16 @@ module ::PollPlugin
|
|||
end
|
||||
|
||||
def is_poll?
|
||||
if !@post.post_number.nil? and @post.post_number > 1
|
||||
# Not a new post, and also not the first post.
|
||||
return false
|
||||
end
|
||||
# Not a new post, and also not the first post.
|
||||
return false if @post.post_number.present? && @post.post_number > 1
|
||||
|
||||
topic = @post.topic
|
||||
|
||||
# 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.
|
||||
return false
|
||||
end
|
||||
# New post, but not the first post in the topic.
|
||||
return false if @post.post_number.nil? && topic.highest_post_number > 0
|
||||
|
||||
I18n.with_locale(topic.user.effective_locale) do
|
||||
topic.title =~ /^(#{I18n.t('poll.prefix').strip}|#{I18n.t('poll.closed_prefix').strip})\s?:/i
|
||||
|
|
Loading…
Reference in a new issue