mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-06-17 06:00:16 -05:00
Helptickets: Ensure reported battles have replays saved upon ending
This is relevant since future staff may want the full log, and we don't want cases where only half the replay is saved.
This commit is contained in:
parent
d4ba4d6262
commit
028abd6377
|
|
@ -26,7 +26,12 @@ export function getCommonBattles(
|
|||
(user1?.inRooms.has(curRoom.roomid) || curRoom.auth.get(userID1) === Users.PLAYER_SYMBOL) &&
|
||||
(user2?.inRooms.has(curRoom.roomid) || curRoom.auth.get(userID2) === Users.PLAYER_SYMBOL)
|
||||
) {
|
||||
if (connection) void curRoom.uploadReplay(connection.user, connection, "forpunishment");
|
||||
if (connection) {
|
||||
void curRoom.uploadReplay(connection.user, connection, "forpunishment");
|
||||
// ensure that replay is saved again when battle ends
|
||||
// in case this is halfway through the battle (staff reviewing later may want the full log)
|
||||
curRoom.battle.replaySaved = true;
|
||||
}
|
||||
battles.push(curRoom.roomid);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -520,9 +520,12 @@ export class HelpTicket extends Rooms.RoomGame {
|
|||
static uploadReplaysFrom(text: string, user: User, conn: Connection) {
|
||||
const rooms = getBattleLinks(text);
|
||||
for (const roomid of rooms) {
|
||||
const room = Rooms.get(roomid);
|
||||
if (!room || !('uploadReplay' in (room as GameRoom))) continue;
|
||||
void (room as GameRoom).uploadReplay(user, conn, "forpunishment");
|
||||
const room = Rooms.get(roomid) as GameRoom | undefined;
|
||||
if (!room || !('uploadReplay' in room)) continue;
|
||||
void room.uploadReplay(user, conn, "forpunishment");
|
||||
// ensure that replay is saved again when battle ends
|
||||
// in case this is halfway through the battle (staff reviewing later may want the full log)
|
||||
if (room.battle) room.battle.replaySaved = true;
|
||||
}
|
||||
}
|
||||
static formatBattleLog(logs: string[], title: string, url: string) {
|
||||
|
|
@ -2244,9 +2247,12 @@ export const commands: Chat.ChatCommands = {
|
|||
let reportTargetInfo = '';
|
||||
if (reportTargetType === 'room') {
|
||||
reportTargetInfo = `Reported in room: <a href="/${reportTarget}">${reportTarget}</a>`;
|
||||
const reportRoom = Rooms.get(reportTarget);
|
||||
if (reportRoom && (reportRoom as GameRoom).uploadReplay) {
|
||||
void (reportRoom as GameRoom).uploadReplay(user, connection, 'forpunishment');
|
||||
const reportRoom = Rooms.get(reportTarget) as GameRoom | undefined;
|
||||
if (reportRoom && 'uploadReplay' in reportRoom) {
|
||||
void reportRoom.uploadReplay(user, connection, 'forpunishment');
|
||||
// ensure that replay is saved again when battle ends
|
||||
// in case this is halfway through the battle (staff reviewing later may want the full log)
|
||||
if (reportRoom.battle) reportRoom.battle.replaySaved = true;
|
||||
}
|
||||
} else if (reportTargetType === 'user') {
|
||||
reportTargetInfo = `Reported user: <strong class="username">${reportTarget}</strong><p></p>`;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user