Skip to content

Commit

Permalink
Use data- attribute instead of span to store room name
Browse files Browse the repository at this point in the history
  • Loading branch information
BetaRays authored and jcbrand committed Nov 12, 2024
1 parent 567dea1 commit 6c22a90
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/plugins/roomslist/templates/roomslist.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ function tplRoomItem (el, room) {
<a class="list-item-link open-room available-room w-100"
data-room-jid="${room.get('jid')}"
data-room-name="${room.getDisplayName()}"
title="${__('Click to open this groupchat')}"
@click=${ev => el.openRoom(ev)}>
<converse-avatar
Expand All @@ -70,7 +71,7 @@ function tplRoomItem (el, room) {
<span>${ room.get('num_unread') ?
tplUnreadIndicator(room) :
(room.get('has_activity') ? tplActivityIndicator() : '') }
<span class="room-name">${room.getDisplayName()}</span></span>
${room.getDisplayName()}</span>
</a>
${ api.settings.get('allow_bookmarks') ? tplBookmark(room) : '' }
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/roomslist/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class RoomsList extends CustomElement {
async openRoom (ev) {
ev.preventDefault();
const target = u.ancestor(/** @type {HTMLElement} */(ev.target), '.open-room');
const name = target.querySelector(".room-name")?.textContent;
const name = target.getAttribute('data-room-name');
const jid = target.getAttribute('data-room-jid');
const data = {
'name': name || Strophe.unescapeNode(Strophe.getNodeFromJid(jid)) || jid
Expand Down

0 comments on commit 6c22a90

Please sign in to comment.