From b1b29daeec845ad939257b0be213682495b097c2 Mon Sep 17 00:00:00 2001 From: Mia <49593536+mia-pi-git@users.noreply.github.com> Date: Mon, 15 Feb 2021 14:59:20 -0600 Subject: [PATCH] Chat: Fix parseSpoiler adding undefined strings (#8037) And fix /forcerename --- server/chat-commands/moderation.ts | 2 +- server/chat.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server/chat-commands/moderation.ts b/server/chat-commands/moderation.ts index d1083455fe..4f37af8331 100644 --- a/server/chat-commands/moderation.ts +++ b/server/chat-commands/moderation.ts @@ -1527,7 +1527,7 @@ export const commands: ChatCommands = { return this.errorReply(`User '${target}' not found.`); } this.checkCan('forcerename', targetID); - const {publicReason, privateReason} = this.parseSpoiler(target); + const {publicReason, privateReason} = this.parseSpoiler(reason); Monitor.forceRenames.set(targetUser.id, (Monitor.forceRenames.get(targetUser.id) || 0) + 1); diff --git a/server/chat.ts b/server/chat.ts index 1a731e0488..3515ea0dbe 100644 --- a/server/chat.ts +++ b/server/chat.ts @@ -814,7 +814,7 @@ export class CommandContext extends MessageContext { (this.room || Rooms.global).modlog(entry); } parseSpoiler(str: string) { - let privateReason; + let privateReason = ""; if (!str) return {publicReason: "", privateReason}; let publicReason = str;