mirror of https://github.com/tootsuite/mastodon
When a poll is edited, we reset the poll and remove all previous votes. However, prior to this commit, the voter count on the poll was not reset. This leads to incorrect percentages being shown in poll results. Fixes #21696 Co-authored-by: afontenot <adam.m.fontenot@gmail.com>pull/23493/head
parent
1f0be21317
commit
eade64097c
|
@ -85,6 +85,7 @@ class Poll < ApplicationRecord
|
|||
def reset_votes!
|
||||
self.cached_tallies = options.map { 0 }
|
||||
self.votes_count = 0
|
||||
self.voters_count = 0
|
||||
votes.delete_all unless new_record?
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue