Skip to content

Commit 9cf06ef

Browse files
authored
fix: log feedback thread when using /reject (#129)
1 parent 2fe10ae commit 9cf06ef

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/vote/action.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ export async function forceReject (
283283
)
284284

285285
let shouldRunCleanup
286+
let feedbackThread
286287
const logLocation = template.location()
287288

288289
try {
@@ -308,13 +309,17 @@ export async function forceReject (
308309
user: `<@${submission.authorId}>`,
309310
name: submission.name
310311
})
311-
await sendMessageToFeedbackThread(
312+
const result = await sendMessageToFeedbackThread(
312313
{
313314
content: templatedReason
314315
},
315316
submission
316317
)
317318

319+
if (result.didMakeThread) {
320+
feedbackThread = result.thread
321+
}
322+
318323
shouldRunCleanup = true
319324
} else {
320325
shouldRunCleanup = true
@@ -329,6 +334,9 @@ export async function forceReject (
329334
let fields
330335

331336
if (isValidated(submission)) {
337+
// Mutation of submissions is generally ill advised, but this is only for logging, it does not change the real state.
338+
// The state has already been established in the database, so this only brings the object and DB in sync
339+
submission.feedbackThread = feedbackThread
332340
fields = generateDefaultFields(submission, true)
333341
} else {
334342
fields = [

0 commit comments

Comments
 (0)