Converse upstream WIP.
This commit is contained in:
parent
d0ab3d94ae
commit
6218d65b72
@ -61,7 +61,7 @@ CORE_PLUGINS.push('livechat-converse-poll')
|
||||
// (see headless/plugins/muc, getDiscoInfoFeatures, which loops on this const)
|
||||
ROOM_FEATURES.push('x_peertubelivechat_mute_anonymous')
|
||||
|
||||
_converse.CustomElement = CustomElement
|
||||
_converse.exports.CustomElement = CustomElement
|
||||
|
||||
const initialize = converse.initialize
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
/* eslint-disable max-len */
|
||||
import { html } from 'lit'
|
||||
import tplIcons from '../../../src/shared/templates/icons.js'
|
||||
import tplIcons from '../../../src/shared/components/templates/icons.js'
|
||||
|
||||
export default () => {
|
||||
// Here we are adding some additonal icons to ConverseJS defaults
|
||||
|
@ -79,7 +79,7 @@ class SlowMode extends CustomElement {
|
||||
api.elements.define('livechat-slow-mode', SlowMode)
|
||||
|
||||
const tplSlowMode = (o) => {
|
||||
if (!o.can_edit) { return html`` }
|
||||
if (!o.can_post) { return html`` }
|
||||
return html`<livechat-slow-mode jid=${o.model.get('jid')}>`
|
||||
}
|
||||
|
||||
@ -128,17 +128,9 @@ const tplViewerMode = (o) => {
|
||||
}
|
||||
|
||||
export default (o) => {
|
||||
// ConverseJS 10.x does not handle properly the visitor role in unmoderated rooms.
|
||||
// See https://github.com/conversejs/converse.js/issues/3428 for more info.
|
||||
// So we will do a dirty hack here to fix this case.
|
||||
// Note: ConverseJS 11.x has changed the code, and could be fixed more cleanly (or will be fixed if #3428 is fixed).
|
||||
if (o.can_edit && o.model.getOwnRole() === 'visitor') {
|
||||
o.can_edit = false
|
||||
}
|
||||
|
||||
let mutedAnonymousMessage
|
||||
if (
|
||||
!o.can_edit &&
|
||||
!o.can_post &&
|
||||
o.model.features?.get?.('x_peertubelivechat_mute_anonymous') &&
|
||||
_converse.api.settings.get('livechat_specific_is_anonymous') === true
|
||||
) {
|
||||
|
@ -44,7 +44,7 @@ module.exports = merge(prod, {
|
||||
'../../templates/background_logo.js$': path.resolve(__dirname, 'custom/templates/background_logo.js'),
|
||||
'./templates/muc-chatarea.js': path.resolve('custom/templates/muc-chatarea.js'),
|
||||
|
||||
'../templates/icons.js': path.resolve(__dirname, 'custom/shared/components/font-awesome.js'),
|
||||
'./templates/icons.js': path.resolve(__dirname, 'custom/shared/components/font-awesome.js'),
|
||||
|
||||
'shared/styles/index.scss$': path.resolve(__dirname, 'custom/shared/styles/livechat.scss'),
|
||||
|
||||
|
@ -117,7 +117,7 @@ export const livechatSpecificsPlugin = {
|
||||
},
|
||||
overrides: {
|
||||
ChatRoom: {
|
||||
getActionInfoMessage: function (this: any, code: string, nick: string, actor: any): any {
|
||||
getActionInfoMessage: function getActionInfoMessage (this: any, code: string, nick: string, actor: any): any {
|
||||
if (code === '303') {
|
||||
// When there is numerous anonymous users joining at the same time,
|
||||
// they can all change their nicknames at the same time, generating a log of action messages.
|
||||
@ -130,6 +130,12 @@ export const livechatSpecificsPlugin = {
|
||||
}
|
||||
}
|
||||
return this.__super__.getActionInfoMessage(code, nick, actor)
|
||||
},
|
||||
canPostMessages: function canPostMessages (this: any) {
|
||||
// ConverseJS does not handle properly the visitor role in unmoderated rooms.
|
||||
// See https://github.com/conversejs/converse.js/issues/3428 for more info.
|
||||
// FIXME: if #3428 is fixed, remove this override.
|
||||
return this.isEntered() && this.getOwnRole() !== 'visitor'
|
||||
}
|
||||
},
|
||||
ChatRoomMessage: {
|
||||
|
Loading…
Reference in New Issue
Block a user