mirror of
https://github.com/smogon/pokemon-showdown-client.git
synced 2026-03-21 17:50:29 -05:00
Preact: Fix /nonotify and raw message parsing in PMs (#2565)
Some checks failed
Node.js CI / build (22.x) (push) Has been cancelled
Some checks failed
Node.js CI / build (22.x) (push) Has been cancelled
--------- Co-authored-by: Guangcong Luo <guangcongluo@gmail.com>
This commit is contained in:
parent
be3d1edcae
commit
53171f59ac
|
|
@ -1295,7 +1295,7 @@ export class BattleLog {
|
|||
case 'data-move':
|
||||
return ['chat message-error', '[outdated code no longer supported]'];
|
||||
case 'text':
|
||||
return ['chat', BattleLog.parseMessage(target)];
|
||||
return ['chat', BattleLog.parseMessage(target), true];
|
||||
case 'error':
|
||||
return ['chat message-error', formatText(target, true)];
|
||||
case 'html':
|
||||
|
|
|
|||
|
|
@ -139,16 +139,25 @@ export class ChatRoom extends PSRoom {
|
|||
if (args[0] === 'c:') PS.lastMessageTime = args[1];
|
||||
this.lastMessage = args;
|
||||
this.joinLeave = null;
|
||||
this.markUserActive(args[args[0] === 'c:' ? 2 : 1]);
|
||||
const name = args[args[0] === 'c:' ? 2 : 1];
|
||||
this.markUserActive(name);
|
||||
if (this.tour) this.tour.joinLeave = null;
|
||||
if (this.id.startsWith("dm-")) {
|
||||
const fromUser = args[args[0] === 'c:' ? 2 : 1];
|
||||
if (toID(fromUser) === PS.user.userid) break;
|
||||
const message = args[args[0] === 'c:' ? 3 : 2];
|
||||
this.notify({
|
||||
title: `${this.title}`,
|
||||
body: message,
|
||||
});
|
||||
const noNotify = this.log?.parseChatMessage(message, name, args[1])?.[2];
|
||||
if (!noNotify) {
|
||||
let textContent = message;
|
||||
if (/^\/(log|raw|html|uhtml|uhtmlchange) /.test(message)) {
|
||||
textContent = message.split(' ').slice(1).join(' ')
|
||||
.replace(/<[^>]*?>/g, '');
|
||||
}
|
||||
this.notify({
|
||||
title: `${this.title}`,
|
||||
body: textContent,
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.subtleNotify();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user