summaryrefslogtreecommitdiff
path: root/internal/processing/workers
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2023-11-08 22:37:35 +0000
committerLibravatar GitHub <noreply@github.com>2023-11-08 23:37:35 +0100
commit34d0879c1651d2703f94c1b653227c718aac475f (patch)
treeed215b9ef2b149238a56ccc988ba599224e1fc04 /internal/processing/workers
parent[feature] add support for polls + receiving federated status edits (#2330) (diff)
downloadgotosocial-34d0879c1651d2703f94c1b653227c718aac475f.tar.xz
[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
Diffstat (limited to 'internal/processing/workers')
-rw-r--r--internal/processing/workers/fromfediapi.go4
1 files changed, 4 insertions, 0 deletions
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 {