about summary refs log tree commit diff
path: root/app/models/poll.rb
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2019-03-08 00:54:50 +0100
committerEugen Rochko <eugen@zeonfederated.com>2019-03-08 00:54:50 +0100
commit3aaac4f134eb092baeb0ba5979bdb3abd702a4ee (patch)
tree166112abcd990ece652d0be5792be5d54edd58cc /app/models/poll.rb
parent054bbb3da21b2c76374eb921cba862adb8d5a0b3 (diff)
Do not allow adding votes to expired polls (#10214)
* Do not allow adding votes to expired polls

* Only validate expires_at on create
Diffstat (limited to 'app/models/poll.rb')
-rw-r--r--app/models/poll.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/poll.rb b/app/models/poll.rb
index 14a38026a..09f0b65ec 100644
--- a/app/models/poll.rb
+++ b/app/models/poll.rb
@@ -28,7 +28,7 @@ class Poll < ApplicationRecord
 
   validates :options, presence: true
   validates :expires_at, presence: true, if: :local?
-  validates_with PollValidator, if: :local?
+  validates_with PollValidator, on: :create, if: :local?
 
   scope :attached, -> { where.not(status_id: nil) }
   scope :unattached, -> { where(status_id: nil) }