Fix partial room token matches in JS

dev
gravel 6 months ago
parent 942839373f
commit 6d45d5ceca
Signed by: gravel
GPG Key ID: C0538F3C906B308F

@ -83,9 +83,17 @@ export const dom = {
tbl_communities: () => document.getElementById("tbl_communities"),
tbl_communities_content_rows:
() => Array.from(dom.tbl_communities()?.rows)?.filter(row => !row.querySelector('th')),
/**
* @param {string} communityID
* @param {bool} matchIdPrefix
* @returns {HTMLRowElement | null}
*/
community_row: (communityID, matchIdPrefix=false) => {
const identifier = ATTRIBUTES.ROW.IDENTIFIER;
// Support matching shorter legacy IDs in links online
const matches = matchIdPrefix ? '^=' : '=';
// Support matching room token, but only as a full match (plus symbol and hex code follows)
const id = communityID.includes('+') ? `${communityID}+` : communityID;
return document.querySelector(`.room-row[${identifier}${matches}"${communityID}"]`);
},
/**

Loading…
Cancel
Save