mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-06-10 03:26:28 +08:00
Ranked-choice polls always serialized `ranked_choice_outcome` (the computed winner and round-by-round activity) regardless of the poll's `results` setting, unlike vote counts and voter lists, which are gated by `Poll#can_see_results?`. The outcome was therefore displayed to users who should not yet see results on `on_vote`, `on_close`, and `staff_only` polls — through the topic view, the vote/remove-vote responses, and the MessageBus broadcast. - Gate `ranked_choice_outcome` in `PollSerializer` behind `can_see_results?`, matching the other result fields. - Stop manually re-appending the outcome in `vote`/`remove_vote` so the serializer's gating is authoritative. - Serialize the MessageBus payload as an anonymous user so the topic-wide broadcast only carries data any viewer may see, matching `PollsUpdater.publish_changes`. - Don't render an empty results panel to a non-staff voter on a `staff_only` poll; show the ballot and the staff-only notice instead. Relates to /t/-/185090 And Patch 998 Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| poll | ||
| poll.rb | ||
| polls_updater.rb | ||
| polls_validator.rb | ||
| post_extension.rb | ||
| post_validator.rb | ||
| ranked_choice.rb | ||
| user_extension.rb | ||