From eed4fd586bbfc30f81a7c2e9f89f7776097cf050 Mon Sep 17 00:00:00 2001 From: Dragory <2606411+Dragory@users.noreply.github.com> Date: Sat, 22 May 2021 14:01:00 +0300 Subject: [PATCH] Fix unnecessary 'go to original case' links in case log channel --- backend/src/plugins/Cases/functions/getCaseEmbed.ts | 3 ++- backend/src/plugins/Cases/functions/postToCaseLogChannel.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/src/plugins/Cases/functions/getCaseEmbed.ts b/backend/src/plugins/Cases/functions/getCaseEmbed.ts index d9482415..ec92e059 100644 --- a/backend/src/plugins/Cases/functions/getCaseEmbed.ts +++ b/backend/src/plugins/Cases/functions/getCaseEmbed.ts @@ -13,6 +13,7 @@ export async function getCaseEmbed( pluginData: GuildPluginData, caseOrCaseId: Case | number, requestMemberId?: string, + noOriginalCaseLink?: boolean, ): Promise { const theCase = await pluginData.state.cases.with("notes").find(resolveCaseId(caseOrCaseId)); if (!theCase) { @@ -98,7 +99,7 @@ export async function getCaseEmbed( }); } - if (theCase.log_message_id) { + if (theCase.log_message_id && noOriginalCaseLink !== false) { const [channelId, messageId] = theCase.log_message_id.split("-"); const link = messageLink(pluginData.guild.id, channelId, messageId); embed.fields.push({ diff --git a/backend/src/plugins/Cases/functions/postToCaseLogChannel.ts b/backend/src/plugins/Cases/functions/postToCaseLogChannel.ts index 64057e29..604293e1 100644 --- a/backend/src/plugins/Cases/functions/postToCaseLogChannel.ts +++ b/backend/src/plugins/Cases/functions/postToCaseLogChannel.ts @@ -43,7 +43,7 @@ export async function postCaseToCaseLogChannel( const theCase = await pluginData.state.cases.find(resolveCaseId(caseOrCaseId)); if (!theCase) return null; - const caseEmbed = await getCaseEmbed(pluginData, caseOrCaseId); + const caseEmbed = await getCaseEmbed(pluginData, caseOrCaseId, undefined, true); if (!caseEmbed) return null; if (theCase.log_message_id) {