Fix: clicking on the current user nickname in message history was failing to open the profile modal.
This commit is contained in:
parent
a46425d51f
commit
70f702f78e
@ -16,6 +16,7 @@
|
|||||||
* Translation updates: Crotian, Japanese.
|
* Translation updates: Crotian, Japanese.
|
||||||
* Updated mod_muc_moderation to upstream.
|
* Updated mod_muc_moderation to upstream.
|
||||||
* Fix new task ordering.
|
* Fix new task ordering.
|
||||||
|
* Fix: clicking on the current user nickname in message history was failing to open the profile modal.
|
||||||
|
|
||||||
## 10.3.3
|
## 10.3.3
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ import { initReconnectionStuff } from './livechat-specific/reconnection'
|
|||||||
import { chatRoomOverrides } from './livechat-specific/chatroom'
|
import { chatRoomOverrides } from './livechat-specific/chatroom'
|
||||||
import { chatRoomMessageOverrides } from './livechat-specific/chatroom-message'
|
import { chatRoomMessageOverrides } from './livechat-specific/chatroom-message'
|
||||||
import { customizeMessageAction } from './livechat-specific/message-action'
|
import { customizeMessageAction } from './livechat-specific/message-action'
|
||||||
|
import { customizeProfileModal } from './livechat-specific/profile'
|
||||||
|
|
||||||
export const livechatSpecificsPlugin = {
|
export const livechatSpecificsPlugin = {
|
||||||
dependencies: ['converse-muc', 'converse-muc-views'],
|
dependencies: ['converse-muc', 'converse-muc-views'],
|
||||||
@ -24,6 +25,7 @@ export const livechatSpecificsPlugin = {
|
|||||||
customizeHeading(this)
|
customizeHeading(this)
|
||||||
customizeToolbar(this)
|
customizeToolbar(this)
|
||||||
customizeMessageAction(this)
|
customizeMessageAction(this)
|
||||||
|
customizeProfileModal(this)
|
||||||
|
|
||||||
_converse.api.listen.on('chatRoomViewInitialized', function (this: any, _model: any): void {
|
_converse.api.listen.on('chatRoomViewInitialized', function (this: any, _model: any): void {
|
||||||
// Remove the spinner if present...
|
// Remove the spinner if present...
|
||||||
|
26
conversejs/lib/plugins/livechat-specific/profile.ts
Normal file
26
conversejs/lib/plugins/livechat-specific/profile.ts
Normal 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)
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user