From 34d0879c1651d2703f94c1b653227c718aac475f Mon Sep 17 00:00:00 2001 From: kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com> Date: Wed, 8 Nov 2023 22:37:35 +0000 Subject: [bugfix] fix poll vote count responses on client and fedi API vote creation (#2343) * increment poll votes *before* enqueuing vote to client API worker * increment vote counts before federating status update after vote in local poll * improved vote count calculation during backend -> frontend model conversion --- internal/processing/workers/fromfediapi.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'internal/processing/workers/fromfediapi.go') diff --git a/internal/processing/workers/fromfediapi.go b/internal/processing/workers/fromfediapi.go index 2b0bfa9fa..9558bf8b7 100644 --- a/internal/processing/workers/fromfediapi.go +++ b/internal/processing/workers/fromfediapi.go @@ -233,6 +233,10 @@ func (p *fediAPI) CreatePollVote(ctx context.Context, fMsg messages.FromFediAPI) p.surface.invalidateStatusFromTimelines(ctx, vote.Poll.StatusID) if *status.Local { + // Before federating it, increment the + // poll vote counts on our local copy. + status.Poll.IncrementVotes(vote.Choices) + // These were poll votes in a local status, we need to // federate the updated status model with latest vote counts. if err := p.federate.UpdateStatus(ctx, status); err != nil { -- cgit v1.2.3