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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user