FIX: makes sur we have polls before validating
This commit is contained in:
parent
daeb7694bc
commit
067d454937
|
@ -312,12 +312,14 @@ after_initialize do
|
||||||
# only care when raw has changed!
|
# only care when raw has changed!
|
||||||
return unless self.raw_changed? || force
|
return unless self.raw_changed? || force
|
||||||
|
|
||||||
validator = DiscoursePoll::PostValidator.new(self)
|
|
||||||
return unless validator.validate_post
|
|
||||||
|
|
||||||
validator = DiscoursePoll::PollsValidator.new(self)
|
validator = DiscoursePoll::PollsValidator.new(self)
|
||||||
return unless (polls = validator.validate_polls)
|
return unless (polls = validator.validate_polls)
|
||||||
|
|
||||||
|
if !polls.empty?
|
||||||
|
validator = DiscoursePoll::PostValidator.new(self)
|
||||||
|
return unless validator.validate_post
|
||||||
|
end
|
||||||
|
|
||||||
# are we updating a post?
|
# are we updating a post?
|
||||||
if self.id.present?
|
if self.id.present?
|
||||||
DistributedMutex.synchronize("#{PLUGIN_NAME}-#{self.id}") do
|
DistributedMutex.synchronize("#{PLUGIN_NAME}-#{self.id}") do
|
||||||
|
|
Loading…
Reference in New Issue