Explorar o código

Fix muc icons not working due to incorrect target element.

Keith Maika %!s(int64=2) %!d(string=hai) anos
pai
achega
92f71bafb2
Modificáronse 3 ficheiros con 7 adicións e 6 borrados
  1. 1 0
      CHANGES.md
  2. 3 3
      src/plugins/bookmark-views/utils.js
  3. 3 3
      src/plugins/roomslist/view.js

+ 1 - 0
CHANGES.md

@@ -17,6 +17,7 @@
 - #2936: Fix documentation about enable_smacks option, which is true by default.
 - #3005: Fix MUC messages with a fallback body not rendering.
 - #3007: Fix links becoming text when a message is edited
+- #3018: Fix MUC icons not functioning.
 
 ## 9.1.1 (2022-05-05)
 

+ 3 - 3
src/plugins/bookmark-views/utils.js

@@ -27,8 +27,8 @@ export function getHeadingButtons (view, buttons) {
 
 export async function removeBookmarkViaEvent (ev) {
     ev.preventDefault();
-    const name = ev.target.getAttribute('data-bookmark-name');
-    const jid = ev.target.getAttribute('data-room-jid');
+    const name = ev.currentTarget.getAttribute('data-bookmark-name');
+    const jid = ev.currentTarget.getAttribute('data-room-jid');
     const result = await api.confirm(__('Are you sure you want to remove the bookmark "%1$s"?', name));
     if (result) {
         invokeMap(_converse.bookmarks.where({ jid }), Model.prototype.destroy);
@@ -37,7 +37,7 @@ export async function removeBookmarkViaEvent (ev) {
 
 export function addBookmarkViaEvent (ev) {
     ev.preventDefault();
-    const jid = ev.target.getAttribute('data-room-jid');
+    const jid = ev.currentTarget.getAttribute('data-room-jid');
     api.modal.show(MUCBookmarkFormModal, { jid }, ev);
 }
 

+ 3 - 3
src/plugins/roomslist/view.js

@@ -55,7 +55,7 @@ export class RoomsList extends CustomElement {
     }
 
     showRoomDetailsModal (ev) { // eslint-disable-line class-methods-use-this
-        const jid = ev.target.getAttribute('data-room-jid');
+        const jid = ev.currentTarget.getAttribute('data-room-jid');
         const room = _converse.chatboxes.get(jid);
         ev.preventDefault();
         api.modal.show(RoomDetailsModal, {'model': room}, ev);
@@ -73,10 +73,10 @@ export class RoomsList extends CustomElement {
 
     async closeRoom (ev) { // eslint-disable-line class-methods-use-this
         ev.preventDefault();
-        const name = ev.target.getAttribute('data-room-name');
+        const name = ev.currentTarget.getAttribute('data-room-name');
+        const jid = ev.currentTarget.getAttribute('data-room-jid');
         const result = await api.confirm(__("Are you sure you want to leave the groupchat %1$s?", name));
         if (result) {
-            const jid = ev.target.getAttribute('data-room-jid');
             const room = await api.rooms.get(jid);
             room.close();
         }