Fix 355: Make the ConverseJS dropdown menu available everywhere (WIP)

This commit is contained in:
John Livingston
2024-04-11 11:25:04 +02:00
parent eb1a959aa0
commit 4948d27fae
7 changed files with 147 additions and 9 deletions

View File

@ -77,6 +77,7 @@ function defaultConverseParams (
whitelisted_plugins: [
'livechatWindowTitlePlugin',
'livechatSpecifics',
'livechatMiniMucHeadPlugin',
'livechatViewerModePlugin',
'livechatDisconnectOnUnloadPlugin',
'converse-slow-mode'

View File

@ -0,0 +1,25 @@
/**
* Plugin to add buttons (help, close, open in another window) in the muc menu,
* when we are embedded in Peertube.
*/
export const livechatMiniMucHeadPlugin = {
dependencies: ['converse-muc', 'converse-muc-views'],
initialize: function (this: any) {
const _converse = this._converse
_converse.api.settings.extend({
// tells the overloaded template to render differently.
livechat_mini_muc_head: false
})
_converse.api.listen.on('getHeadingButtons', (view: any, buttons: any[]) => {
if (view.model.get('type') !== _converse.CHATROOMS_TYPE) {
// only on MUC.
return
}
// removing the 'show/hide topic' buttons
buttons = buttons.filter(b => b.name !== 'toggle-topic')
return buttons
})
}
}