Poll fixes:

* update poll banner when user role changes
* don't show instructions if user can't vote
This commit is contained in:
John Livingston
2024-07-05 14:48:02 +02:00
parent 867c1debd6
commit 914de79400
3 changed files with 11 additions and 9 deletions

View File

@ -6,8 +6,8 @@ import { html } from 'lit'
import { repeat } from 'lit/directives/repeat.js'
import { __ } from 'i18n'
function _tplPollInstructions (el, currentPoll) {
if (currentPoll.over) {
function _tplPollInstructions (el, currentPoll, canVote) {
if (currentPoll.over || !canVote) {
return html``
}
@ -115,7 +115,7 @@ export function tplPoll (el, currentPoll, canVote) {
<table><tbody>
${repeat(currentPoll.choices ?? [], (c) => c.choice, (c) => _tplChoice(el, currentPoll, c, canVote))}
</tbody></table>
${_tplPollInstructions(el, currentPoll)}
${_tplPollInstructions(el, currentPoll, canVote)}
${_tplPollEnd(el, currentPoll)}
`
}