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

@ -4,7 +4,7 @@
import { tplPoll } from '../templates/poll.js'
import { CustomElement } from 'shared/components/element.js'
import { converse, api } from '@converse/headless/core'
import { converse, _converse, api } from '@converse/headless/core'
import '../styles/poll.scss'
export default class MUCPollView extends CustomElement {
@ -26,6 +26,13 @@ export default class MUCPollView extends CustomElement {
this.buttonDisabled = false
this.requestUpdate()
})
this.listenTo(this.model.occupants, 'change:role', occupant => {
if (occupant.get('jid') !== _converse.bare_jid) { // only for myself
return
}
// visitors cant vote. So we must refresh the polls results when current occupant role changes.
this.requestUpdate()
})
}
render () {