Refuse a bot token without a channel
Saving a token and leaving the channel empty produced a state that could neither send nor delete, and only said so at the next attempt.
This commit is contained in:
@@ -36,6 +36,13 @@ export async function performSaveSlack(viewer: Viewer, formData: FormData): Prom
|
||||
return invalid('tokenInvalid', undefined, { botToken: 'tokenInvalid' })
|
||||
}
|
||||
|
||||
const stored = await readSettings(['slack.botToken'])
|
||||
const withToken = keepToken ? Boolean(stored.get('slack.botToken')) : token !== ''
|
||||
|
||||
if (withToken && channel === '') {
|
||||
return invalid('channelRequired', undefined, { channel: 'channelRequired' })
|
||||
}
|
||||
|
||||
if (!keep) {
|
||||
if (webhook === '') {
|
||||
await clearSetting('slack.webhook')
|
||||
|
||||
Reference in New Issue
Block a user