Report what Slack actually answers

The lookup swallowed Slack's error and the interface guessed at a cause.
It now shows the raw reason, widens the search window to six hours and
falls back to matching the message prefix.
This commit is contained in:
Matthias G
2026-08-03 13:03:32 +02:00
parent 7a10754e70
commit bb5028ee55
5 changed files with 45 additions and 19 deletions
+14 -8
View File
@@ -132,21 +132,27 @@ export async function performDeleteMessage(viewer: Viewer, formData: FormData):
return invalid('runNoChannel')
}
const messageTs = run.messageTs ?? await findMessageTs({
token,
channel,
text: reportText({ from: run.fromAt, to: run.toAt, total: run.total }),
around: run.createdAt,
})
let messageTs = run.messageTs
if (!messageTs) {
return invalid('runNotFound')
const lookup = await findMessageTs({
token,
channel,
text: reportText({ from: run.fromAt, to: run.toAt, total: run.total }),
around: run.createdAt,
})
if (!lookup.ok) {
return invalid('slackSaid', { detail: lookup.detail })
}
messageTs = lookup.messageTs
}
const result = await deleteFromSlack(token, channel, messageTs)
if (!result.ok) {
return invalid('runDeleteFailed')
return invalid('slackSaid', { detail: result.detail })
}
await markReportRunDeleted(run.id)