diff --git a/conversejs/custom/plugins/poll/components/poll-view.js b/conversejs/custom/plugins/poll/components/poll-view.js index 53d7e939..8742f044 100644 --- a/conversejs/custom/plugins/poll/components/poll-view.js +++ b/conversejs/custom/plugins/poll/components/poll-view.js @@ -53,6 +53,11 @@ export default class MUCPollView extends CustomElement { body: '!' + choice.choice }) } + + closePoll (ev) { + ev.preventDefault() + this.model.set('current_poll', undefined) + } } api.elements.define('livechat-converse-muc-poll', MUCPollView) diff --git a/conversejs/custom/plugins/poll/index.js b/conversejs/custom/plugins/poll/index.js index adf72ca7..b87f804c 100644 --- a/conversejs/custom/plugins/poll/index.js +++ b/conversejs/custom/plugins/poll/index.js @@ -71,7 +71,7 @@ converse.plugins.add('livechat-converse-poll', { return this.__super__.onMessage(attrs) } // We intercept poll messages, to show the banner. - // Note: we also show the message in the chat. + // Note: we also show poll end messages in the chat, so that the user don't loose the result. 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') diff --git a/conversejs/custom/plugins/poll/styles/poll.scss b/conversejs/custom/plugins/poll/styles/poll.scss index ca5476ec..81ac2dd8 100644 --- a/conversejs/custom/plugins/poll/styles/poll.scss +++ b/conversejs/custom/plugins/poll/styles/poll.scss @@ -23,6 +23,12 @@ padding-right: 0.25em; } + .livechat-poll-close { + background: unset; + border: 0; + float: right; + } + p.livechat-poll-question { text-align: center; font-weight: bold; diff --git a/conversejs/custom/plugins/poll/templates/poll.js b/conversejs/custom/plugins/poll/templates/poll.js index 703cb114..e4367126 100644 --- a/conversejs/custom/plugins/poll/templates/poll.js +++ b/conversejs/custom/plugins/poll/templates/poll.js @@ -82,6 +82,12 @@ export function tplPoll (el, currentPoll) { return html`
+ ${currentPoll.over + ? html`` + : '' + } ${el.collapsed ? html`