about summary refs log tree commit diff
path: root/app/services/vote_service.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/services/vote_service.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/services/vote_service.rb')
-rw-r--r--app/services/vote_service.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/app/services/vote_service.rb b/app/services/vote_service.rb
index 8bab2810e..5b80da03a 100644
--- a/app/services/vote_service.rb
+++ b/app/services/vote_service.rb
@@ -11,6 +11,8 @@ class VoteService < BaseService
     @choices = choices
     @votes   = []
 
+    return if @poll.expired?
+
     ApplicationRecord.transaction do
       @choices.each do |choice|
         @votes << @poll.votes.create!(account: @account, choice: choice)