mirror of
https://gitgud.io/BondageProjects/Bondage-College.git
synced 2025-04-25 17:59:34 +00:00
Merge branch 'fix-name-mention-notif' into 'master'
Fix "Name Mentioned" notification not working for players with "fancy" (italic, bold etc.) nicknames See merge request BondageProjects/Bondage-College!5467
This commit is contained in:
commit
f1d389922f
1 changed files with 4 additions and 3 deletions
|
@ -3357,9 +3357,10 @@ const mentionNameSplitter = /\b/gu;
|
|||
* @returns {boolean} - msg contains mention of C
|
||||
*/
|
||||
function ChatRoomMessageMentionsCharacter(C, msg) {
|
||||
const nameParts = C.Name.toLowerCase().split(mentionNameSplitter);
|
||||
const nickParts = C.Nickname ? C.Nickname.toLowerCase().split(mentionNameSplitter) : [];
|
||||
const msgParts = msg.toLowerCase().split(mentionNameSplitter);
|
||||
const normalizeText = (text) => text.normalize('NFKC').toLowerCase();
|
||||
const nameParts = normalizeText(C.Name).split(mentionNameSplitter);
|
||||
const nickParts = C.Nickname ? normalizeText(C.Nickname).split(mentionNameSplitter) : [];
|
||||
const msgParts = normalizeText(msg).split(mentionNameSplitter);
|
||||
for (let i = 0; i < msgParts.length - (nameParts.length - 1); i++) {
|
||||
if (msgParts[i] === nameParts[0]) {
|
||||
let match = true;
|
||||
|
|
Loading…
Add table
Reference in a new issue