Do not allow adding votes to expired polls (#10214)
* Do not allow adding votes to expired polls * Only validate expires_at on create
This commit is contained in:
parent
054bbb3da2
commit
3aaac4f134
4 changed files with 26 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue