Skip to content

Commit

Permalink
also apply reason checking to updateCase's notes
Browse files Browse the repository at this point in the history
Signed-off-by: GitHub <[email protected]>
  • Loading branch information
metal0 authored Feb 27, 2023
1 parent 5c51b7c commit 03c7ec9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion backend/src/plugins/ModActions/functions/updateCase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ import { CasesPlugin } from "../../../plugins/Cases/CasesPlugin";
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { formatReasonWithAttachments } from "./formatReasonWithAttachments";
import { LogsPlugin } from "../../Logs/LogsPlugin";
import { parseReason } from "./parseReason.js";
import { GuildPluginData } from "knub";
import { ModActionsPluginType } from "../types.js";

export async function updateCase(pluginData, msg: Message, args) {
export async function updateCase(pluginData: GuildPluginData<ModActionsPluginType>, msg: Message, args) {
let theCase: Case | undefined;
if (args.caseNumber != null) {
theCase = await pluginData.state.cases.findByCaseNumber(args.caseNumber);
Expand All @@ -24,6 +27,8 @@ export async function updateCase(pluginData, msg: Message, args) {
sendErrorMessage(pluginData, msg.channel as TextChannel, "Text or attachment required");
return;
}
const config = pluginData.config.get();
args.note &&= parseReason(config, args.note);

const note = formatReasonWithAttachments(args.note, [...msg.attachments.values()]);

Expand Down

0 comments on commit 03c7ec9

Please sign in to comment.