mirror of
https://github.com/smogon/pokemon-showdown-client.git
synced 2026-03-21 17:50:29 -05:00
Preact: Fix format normalization
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
Fixes #2552
This commit is contained in:
parent
a204b277ed
commit
be3d1edcae
|
|
@ -1086,6 +1086,17 @@ export class BattleLog {
|
|||
}
|
||||
return this.escapeHTML(this.formatName(formatid, fixGen6));
|
||||
}
|
||||
static formatId(format: string): ID {
|
||||
const atIndex = format.indexOf('@@@');
|
||||
if (atIndex >= 0) {
|
||||
format = toID(format.slice(0, atIndex)) + format.slice(atIndex).trim();
|
||||
} else {
|
||||
format = toID(format);
|
||||
}
|
||||
if (!format) return '' as ID;
|
||||
if (!format.startsWith('gen')) format = `${Dex.modid}${format}`;
|
||||
return format as ID;
|
||||
}
|
||||
/**
|
||||
* Do not store this output anywhere; it removes the generation number
|
||||
* for the current gen.
|
||||
|
|
|
|||
|
|
@ -313,8 +313,7 @@ export class ChatRoom extends PSRoom {
|
|||
format = target;
|
||||
targetUser = this.pmTarget;
|
||||
}
|
||||
format = (format || '').trim();
|
||||
if (!format.startsWith('gen')) format = `${Dex.modid}${format}`;
|
||||
format = BattleLog.formatId(format || '');
|
||||
PS.mainmenu.makeQuery('userdetails', targetUser).then(data => {
|
||||
if (data.rooms === false) return this.errorReply('This player does not exist or is not online.');
|
||||
PS.join(`challenge-${toID(targetUser)}` as RoomID, { args: { format } });
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user