Fix: clicking on the current user nickname in message history was failing to open the profile modal.

This commit is contained in:
John Livingston 2024-07-31 17:45:51 +02:00
parent a46425d51f
commit 70f702f78e
No known key found for this signature in database
GPG Key ID: B17B5640CE66CDBC
3 changed files with 29 additions and 0 deletions

View File

@ -16,6 +16,7 @@
* Translation updates: Crotian, Japanese.
* Updated mod_muc_moderation to upstream.
* Fix new task ordering.
* Fix: clicking on the current user nickname in message history was failing to open the profile modal.
## 10.3.3

View File

@ -8,6 +8,7 @@ import { initReconnectionStuff } from './livechat-specific/reconnection'
import { chatRoomOverrides } from './livechat-specific/chatroom'
import { chatRoomMessageOverrides } from './livechat-specific/chatroom-message'
import { customizeMessageAction } from './livechat-specific/message-action'
import { customizeProfileModal } from './livechat-specific/profile'
export const livechatSpecificsPlugin = {
dependencies: ['converse-muc', 'converse-muc-views'],
@ -24,6 +25,7 @@ export const livechatSpecificsPlugin = {
customizeHeading(this)
customizeToolbar(this)
customizeMessageAction(this)
customizeProfileModal(this)
_converse.api.listen.on('chatRoomViewInitialized', function (this: any, _model: any): void {
// Remove the spinner if present...

View File

@ -0,0 +1,26 @@
// SPDX-FileCopyrightText: 2024 John Livingston <https://www.john-livingston.fr/>
//
// SPDX-License-Identifier: AGPL-3.0-only
/**
* Livechat Converse does not include plugins/profile,
* so the default profile modal is broken.
* Moreover this modal includes some features that we do not want (password change, ...).
* So we simply define the converse-profile-modal to be converse-muc-occupant-modal!
* @param plugin The plugin object
*/
export function customizeProfileModal (plugin: any): void {
const _converse = plugin._converse
const OccupantModal = _converse.api.elements.registry['converse-muc-occupant-modal']
if (!OccupantModal) { return }
class ProfileModal extends OccupantModal {
initialize (): any {
// We just need to change the modal for the occupant:
if (this.model?.getOccupant) {
this.model = this.model.getOccupant()
}
return super.initialize()
}
}
_converse.api.elements.define('converse-profile-modal', ProfileModal)
}