4 Commits

7 changed files with 42 additions and 5 deletions

View File

@ -1,5 +1,18 @@
# Changelog
## 10.3.2
### Minor changes and fixes
* Fix #477: ended polls never disappear when archiving is disabled (and no more than 20 new messages).
## 10.3.1
### Minor changes and fixes
* Moderation delay: fix accessibility on the timer shown to moderators.
* Fix «create new poll» icon.
## 10.3.0
### New features

View File

@ -12,6 +12,8 @@ import './components/poll-form-view.js'
const { sizzle } = converse.env
const delayedTimeout = 2 // for delayed poll message, how long must the be considered as valid.
converse.plugins.add('livechat-converse-poll', {
dependencies: ['converse-muc', 'converse-disco'],
@ -97,6 +99,23 @@ converse.plugins.add('livechat-converse-poll', {
if (attrs.is_archived) {
return this.__super__.onMessage(attrs)
}
if (attrs.is_delayed) {
// When archiving is disabled, the "history" mechanism is still available:
// Last X (20 by default) messages will be kept, and sent to users.
// The only thing that differentiates such messages is that they are delayed.
// We can't just ignore all delayed messages, because if one day we enable SMACKS
// (to handle deconnections on poor network), there could be some legitimate delayed messages.
// So we will only ignore the poll if it was sent more than X minutes ago.
console.debug('Got a delayed poll message, checking if old or not')
const d = new Date()
d.setMinutes(d.getMinutes() - delayedTimeout)
if (attrs.time < d.toISOString()) {
console.debug(
`Poll message was delayed fore more than ${delayedTimeout} minutes (${attrs.time} < ${d.toISOString()}).`
)
return this.__super__.onMessage(attrs)
}
}
console.info('Got a poll message, setting it as the current_poll')
// this will be displayed by the livechat-converse-muc-poll custom element,

View File

@ -32,7 +32,7 @@ export function getHeadingButtons (view, buttons) {
api.modal.show('livechat-converse-poll-form-modal', { model: muc })
},
a_class: '',
icon_class: 'fa-list-check', // FIXME
icon_class: 'fa-square-poll-horizontal',
name: 'muc-create-poll'
})

View File

@ -23,6 +23,11 @@ export default () => {
<symbol id="icon-circle-question" viewBox="0 0 448 512">
<path d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM169.8 165.3c7.9-22.3 29.1-37.3 52.8-37.3h58.3c34.9 0 63.1 28.3 63.1 63.1c0 22.6-12.1 43.5-31.7 54.8L280 264.4c-.2 13-10.9 23.6-24 23.6c-13.3 0-24-10.7-24-24V250.5c0-8.6 4.6-16.5 12.1-20.8l44.3-25.4c4.7-2.7 7.6-7.7 7.6-13.1c0-8.4-6.8-15.1-15.1-15.1H222.6c-3.4 0-6.4 2.1-7.5 5.3l-.4 1.2c-4.4 12.5-18.2 19-30.6 14.6s-19-18.2-14.6-30.6l.4-1.2zM224 352a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z"/>
</symbol>
<!--!Font Awesome Free 6.5.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.-->
<symbol id="icon-square-poll-horizontal" viewBox="0 0 448 512">
<path d="M448 96c0-35.3-28.7-64-64-64L64 32C28.7 32 0 60.7 0 96L0 416c0 35.3 28.7 64 64 64l320 0c35.3 0 64-28.7 64-64l0-320zM256 160c0 17.7-14.3 32-32 32l-96 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l96 0c17.7 0 32 14.3 32 32zm64 64c17.7 0 32 14.3 32 32s-14.3 32-32 32l-192 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l192 0zM192 352c0 17.7-14.3 32-32 32l-32 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l32 0c17.7 0 32 14.3 32 32z"/>
</symbol>
</svg>
`
}

View File

@ -42,7 +42,7 @@ export const moderationDelayPlugin = {
// Ok... We will add some info about how many remains...
r.pretty_time = window.converse.env.html`
${r.pretty_time}&nbsp;-&nbsp;${Math.round(remains)}
${r.pretty_time}<span aria-hidden="true">&nbsp;-&nbsp;${Math.round(remains)}</span>
`
// and we must update in 1 second...
setTimeout(() => this.requestUpdate(), 1000)

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "peertube-plugin-livechat",
"version": "10.3.0",
"version": "10.3.2",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "peertube-plugin-livechat",
"version": "10.3.0",
"version": "10.3.2",
"license": "AGPL-3.0",
"dependencies": {
"@xmpp/jid": "^0.13.1",

View File

@ -1,7 +1,7 @@
{
"name": "peertube-plugin-livechat",
"description": "PeerTube plugin livechat: create chat rooms for your Peertube lives! Comes with many features: federation, moderation tools, chat bot, chat persistence, OBS integration, ...",
"version": "10.3.0",
"version": "10.3.2",
"license": "AGPL-3.0",
"author": {
"name": "John Livingston",