summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Sam Lade <sam@sentynel.com>2023-12-16 19:12:25 +0000
committerLibravatar tobi <tobi.smethurst@protonmail.com>2024-01-10 13:53:18 +0100
commitb141500e54ddbdb975ad2831842ff3e8fae997df (patch)
tree9c0578cffc90b0f6ebfb0655901a967943c4d79e
parent[bugfix] use a much shorter refresh limit for statuses with polls (#2453) (diff)
downloadgotosocial-b141500e54ddbdb975ad2831842ff3e8fae997df.tar.xz
fix poll total vote double count (#2464)
-rw-r--r--internal/typeutils/internaltofrontend.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/internal/typeutils/internaltofrontend.go b/internal/typeutils/internaltofrontend.go
index 353c719b5..09d538a3d 100644
--- a/internal/typeutils/internaltofrontend.go
+++ b/internal/typeutils/internaltofrontend.go
@@ -1484,6 +1484,9 @@ func (c *Converter) PollToAPIPoll(ctx context.Context, requester *gtsmodel.Accou
// disabled, or the requester is the author
// do we actually populate the vote counts.
+ // If we voted in this poll, we'll have set totalVotes
+ // earlier. Reset here to avoid double counting.
+ totalVotes = 0
if *poll.Multiple {
// The total number of voters are only
// provided in the case of a multiple