From 7a10754e705442dfec410f8c554eda9e6cb13460 Mon Sep 17 00:00:00 2001 From: Matthias G Date: Mon, 3 Aug 2026 12:59:34 +0200 Subject: [PATCH] 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. --- messages/de.json | 6 ++++-- messages/en.json | 6 ++++-- src/components/admin/SlackForm.tsx | 7 ++++++- src/lib/admin-settings.ts | 7 +++++++ 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/messages/de.json b/messages/de.json index 2a50716..7cc841c 100644 --- a/messages/de.json +++ b/messages/de.json @@ -298,7 +298,8 @@ "tokenInvalid": "Ein Bot-Token beginnt mit xoxb oder xoxp.", "runNotSent": "Bei diesem Lauf ging keine Nachricht raus.", "runNoChannel": "Es ist kein Kanal hinterlegt.", - "runNotFound": "Im Kanal war keine passende Nachricht zu finden. Braucht der Bot noch das Recht channels:history?" + "runNotFound": "Im Kanal war keine passende Nachricht zu finden. Braucht der Bot noch das Recht channels:history?", + "channelRequired": "Zum Bot-Token gehört ein Kanal, sonst weiß Logbuch nicht, wohin." }, "errors": { "nameRequired": "Trag einen Namen ein.", @@ -759,7 +760,8 @@ }, "errors": { "webhookInvalid": "Das sieht nicht nach einer Slack-Webhook-Adresse aus.", - "tokenInvalid": "Ein Bot-Token beginnt mit xoxb oder xoxp." + "tokenInvalid": "Ein Bot-Token beginnt mit xoxb oder xoxp.", + "channelRequired": "Zum Bot-Token gehört ein Kanal." }, "tokenStored": "Hinterlegt, wird nicht mehr angezeigt.", "replaceToken": "Anderen Token eintragen", diff --git a/messages/en.json b/messages/en.json index 7d70bbe..563b1df 100644 --- a/messages/en.json +++ b/messages/en.json @@ -298,7 +298,8 @@ "tokenInvalid": "A bot token starts with xoxb or xoxp.", "runNotSent": "That run sent no message.", "runNoChannel": "No channel is stored.", - "runNotFound": "No matching message found in the channel. Does the bot still need channels:history?" + "runNotFound": "No matching message found in the channel. Does the bot still need channels:history?", + "channelRequired": "A bot token needs a channel, otherwise Logbuch has no target." }, "errors": { "nameRequired": "Enter a name.", @@ -759,7 +760,8 @@ }, "errors": { "webhookInvalid": "That does not look like a Slack webhook address.", - "tokenInvalid": "A bot token starts with xoxb or xoxp." + "tokenInvalid": "A bot token starts with xoxb or xoxp.", + "channelRequired": "A bot token needs a channel." }, "tokenStored": "Stored, no longer shown.", "replaceToken": "Enter a different token", diff --git a/src/components/admin/SlackForm.tsx b/src/components/admin/SlackForm.tsx index f173586..93ead0d 100644 --- a/src/components/admin/SlackForm.tsx +++ b/src/components/admin/SlackForm.tsx @@ -64,7 +64,12 @@ export function SlackForm({ hasWebhook, hasBot, channel, fromEnv, includeInterna )} - +