Skip to content

Enquetes: enviar pelo menu de anexo e ler as recebidas - #471

Merged
gabrielhhaber merged 12 commits into
mainfrom
claude/polls-cvyycf
Oct 12, 2026
Merged

gabrielhhaber merged 12 commits into
mainfrom
claude/polls-cvyycf

Conversation

@gabrielhhaber

Copy link
Copy Markdown
Owner

Requested by Gabriel · project thread

Before: uma enquete recebida aparecia como mensagem incompatível (o tipo do WhatsApp Web é poll_creation, e o normalizador esperava pollCreation), e não havia como enviar enquetes.

After: a enquete recebida é lida como a pergunta e depois cada opção com seus votos (mais votadas primeiro); Enter abre uma janela com a lista (ListCtrl). O último item do menu de anexo, "Enquete", abre o diálogo "Nova enquete" (pergunta, opções adicionadas uma a uma, até 12, e "permitir várias respostas") e envia pela rota /send-poll-message, agora auditada como as demais rotas de envio.

How: lógica pura em client/core/polls.py; envio em client/main_window/poll_sending.py (5xx nunca é reenviado); diálogos em client/ui/dialogs/; strings nos 7 idiomas e changelog na versão não lançada.

Fora deste PR: votar em enquetes. O wa-js 4.6.1 não tem API de voto, então precisa de medição numa sessão real do WhatsApp Web; por isso a janela ainda não tem caixas de seleção, e a contagem de votos só aparece se o dado chegar na mensagem.

🤖 Generated with Claude Code

https://claude.ai/code/session_01PHFmZNcEwFvxPVKgfFYLgg


Generated by Claude Code

WhatsApp Web's type for a poll is poll_creation; the normalizer waited for
pollCreation, so polls showed as unsupported. Polls now read as the question
followed by each option with its votes, Enter opens a list of the options, and
the attachment menu's last item sends a poll through a new dialog.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PHFmZNcEwFvxPVKgfFYLgg
@gabrielhhaber gabrielhhaber self-assigned this Oct 11, 2026
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PHFmZNcEwFvxPVKgfFYLgg
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PHFmZNcEwFvxPVKgfFYLgg
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PHFmZNcEwFvxPVKgfFYLgg
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PHFmZNcEwFvxPVKgfFYLgg
Reads votes and casts them through WhatsApp Web's own poll modules (measured
over CDP): new /poll-votes and /vote-poll routes, a check-box list in the poll
window, and counts refreshed into the message rows.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PHFmZNcEwFvxPVKgfFYLgg
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PHFmZNcEwFvxPVKgfFYLgg
Puppeteer ships only a function's own text to the page, so the module-level
helpers were undefined there. The test now serializes each function the same
way. The poll window also freezes its list while it refreshes and no longer
lets the initial ticks mask the user's own vote.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PHFmZNcEwFvxPVKgfFYLgg

Copy link
Copy Markdown
Owner Author

The "Run test suite" check failed with 4 failures, all in tests/test_yesterday_message_date.py (for example '10/10/2026 23:59' == 'Ontem às 23:59'). Those tests depend on the current date and broke when the day rolled over to 2026-10-12 UTC during the run. This PR does not touch that code. I am re-running the failed jobs once.


Generated by Claude Code

While a single-answer poll is focused, Tab reaches a list of its options and
ticking one votes at once. The poll window still confirms with Vote. The
new-poll dialog's Remove button stays disabled until an option exists.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PHFmZNcEwFvxPVKgfFYLgg
The list is hidden and forgotten when the conversation closes or the list mode
switches, and a tick is dropped if its poll is no longer in the open
conversation. A failed vote restores the ticks, an older result never speaks
over a newer tick, the voted item is the focused one, and counts are not
rewritten while the list has focus.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PHFmZNcEwFvxPVKgfFYLgg
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PHFmZNcEwFvxPVKgfFYLgg
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PHFmZNcEwFvxPVKgfFYLgg
@gabrielhhaber
gabrielhhaber marked this pull request as ready for review October 12, 2026 02:18
@gabrielhhaber
gabrielhhaber merged commit 02f326a into main Oct 12, 2026
4 checks passed
@gabrielhhaber
gabrielhhaber deleted the claude/polls-cvyycf branch October 12, 2026 02:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants