diff --git a/server/chat-commands/info.ts b/server/chat-commands/info.ts index af5323c5d0..818a89aa87 100644 --- a/server/chat-commands/info.ts +++ b/server/chat-commands/info.ts @@ -2443,16 +2443,16 @@ export const commands: ChatCommands = { if (this.can('showmedia', null, room)) return this.errorReply(`Use !show instead.`); if (room.pendingApprovals?.has(user.id)) return this.errorReply('You have a request pending already.'); if (!toID(target)) return this.parse(`/help requestshow`); + let [link, comment] = target.split(','); if (!/^https?:\/\//.test(link)) link = `https://${link}`; link = encodeURI(link); if (!room.pendingApprovals) room.pendingApprovals = new Map(); - const info = { + room.pendingApprovals.set(user.id, { name: user.name, link: link, comment: comment, - }; - room.pendingApprovals.set(user.id, info); + }); this.sendReply(`You have requested to show the link: ${link}${comment ? ` (with the comment ${comment})` : ''}.`); room.sendMods( Utils.html`|uhtml|request-${user.id}|
(Requested by ${info.name})`;
- if (info.comment) {
- buf += Utils.html`
${info.comment}
`; + buf += Utils.html`(Requested by ${request.name})`;
+ if (request.comment) {
+ buf += Utils.html`
${request.comment}
`; } else { buf += ``; } diff --git a/server/rooms.ts b/server/rooms.ts index 351fe7db3e..4fd23d53a7 100644 --- a/server/rooms.ts +++ b/server/rooms.ts @@ -1096,7 +1096,7 @@ export class BasicChatRoom extends BasicRoom { logUserStatsInterval: NodeJS.Timer | null; expireTimer: NodeJS.Timer | null; userList: string; - pendingApprovals: Map