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
|
@ -241,6 +241,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
|
|||
|
||||
def poll_vote?
|
||||
return false if replied_to_status.nil? || replied_to_status.poll.nil? || !replied_to_status.local? || !replied_to_status.poll.options.include?(@object['name'])
|
||||
return true if replied_to_status.poll.expired?
|
||||
replied_to_status.poll.votes.create!(account: @account, choice: replied_to_status.poll.options.index(@object['name']), uri: @object['id'])
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue