Skip to content

Commit

Permalink
fix: log feedback thread when using /reject (#129)
Browse files Browse the repository at this point in the history
  • Loading branch information
nullishamy committed Jul 2, 2023
1 parent 2fe10ae commit 9cf06ef
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/vote/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ export async function forceReject (
)

let shouldRunCleanup
let feedbackThread
const logLocation = template.location()

try {
Expand All @@ -308,13 +309,17 @@ export async function forceReject (
user: `<@${submission.authorId}>`,
name: submission.name
})
await sendMessageToFeedbackThread(
const result = await sendMessageToFeedbackThread(
{
content: templatedReason
},
submission
)

if (result.didMakeThread) {
feedbackThread = result.thread
}

shouldRunCleanup = true
} else {
shouldRunCleanup = true
Expand All @@ -329,6 +334,9 @@ export async function forceReject (
let fields

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

0 comments on commit 9cf06ef

Please sign in to comment.