Poll WIP (#231):

* various fix and improvements
This commit is contained in:
John Livingston
2024-07-04 14:04:33 +02:00
parent 1c6434630e
commit 4168b2ce41
6 changed files with 49 additions and 9 deletions

View File

@ -69,9 +69,14 @@ converse.plugins.add('livechat-converse-poll', {
if (!attrs.current_poll) {
return this.__super__.onMessage(attrs)
}
// We intercept poll messages, so they won't show up in the chat as classic messages.
if (attrs.is_delayed) {
console.info('Got a delayed poll message, just dropping')
// We intercept poll messages, to show the banner.
// Note: we also show the message in the chat.
if (attrs.is_delayed || attrs.is_archived) {
if (attrs.current_poll.over) {
console.info('Got a delayed/archived poll message for an poll that is over, just displaying in the chat')
return this.__super__.onMessage(attrs)
}
console.info('Got a delayed/archived poll message, just dropping')
return
}
@ -79,6 +84,11 @@ converse.plugins.add('livechat-converse-poll', {
this.set('current_poll', attrs.current_poll)
// this will be displayed by the livechat-converse-muc-poll custom element,
// which is inserted in the DOM by the muc.js template overload.
if (attrs.current_poll.over) {
console.info('The poll is over, displaying the message in the chat')
return this.__super__.onMessage(attrs)
}
// Dropping the message.
}
}
}