Add voteCounts override property for remote AP polls#157
Open
julianlam wants to merge 1 commit into
Open
Conversation
Introduce a read-only voteCounts property on poll objects that allows
polls created from remote ActivityPub Question activities to display
correct vote counts without requiring individual voter identity data.
When voteCounts is present as a JSON field on poll:{pollId}, all vote
counting methods short-circuit and use the stored values instead of
reading from vote sorted sets. This enables aggregate-only vote data
from remote servers to be displayed correctly.
The override shape: { total, uniqueVoters, options: [{ id, voteCount }] }
Assisted-by: unsloth/Qwen3.6-35B-A3B-GGUF
Member
Author
|
I should note that this |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I am implementing ActivityPub integration into the poll plugin. While core can remix the incoming activities into a plugin-compatible
pollsproperty, there is one difference that requires a plugin change:One solution is to introduce a
voteCountsproperty in the poll hash itself which is a JSON-serialized aggregate of vote counts. This would only apply to remote polls created via AP. Local polls would not be affected.AI summary
Introduce a read-only voteCounts property on poll objects that allows
polls created from remote ActivityPub Question activities to display
correct vote counts without requiring individual voter identity data.
When voteCounts is present as a JSON field on poll:{pollId}, all vote
counting methods short-circuit and use the stored values instead of
reading from vote sorted sets. This enables aggregate-only vote data
from remote servers to be displayed correctly.
The override shape: { total, uniqueVoters, options: [{ id, voteCount }] }
Assisted-by: unsloth/Qwen3.6-35B-A3B-GGUF
Summary of changes
New method: Poll.getVoteCountsOverride(pollId) — reads the voteCounts field from the poll hash, validates the shape ({ total, options: [{
id, voteCount }] }), and returns the parsed object or null.
Five callers short-circuit when an override exists:
How to set the override (from your AP code)