From b98f947efe12054165594fd821c1c6c55bfa196b Mon Sep 17 00:00:00 2001 From: Sanaei Date: Sun, 13 Sep 2026 12:01:55 +0200 Subject: [PATCH] fix(tgbot): answer only the link callbacks that match nothing #6493 was written against the if/else chain where every served link action returned early, so its trailing answer ran only for an unrouted payload. #6489 had already turned that chain into a switch that falls through, so after the merge every served link tap also got an error toast, while an unknown payload still returned from the !ok branch unanswered. Move the answer into the !ok branch, the one place nothing matched. This turns TestClientLinkCallbackServesOwnClient and TestUnroutableCallbackIsAnswered green again on main's go-test job. --- internal/web/service/tgbot/tgbot_router.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/internal/web/service/tgbot/tgbot_router.go b/internal/web/service/tgbot/tgbot_router.go index 63407e499..66509bcf5 100644 --- a/internal/web/service/tgbot/tgbot_router.go +++ b/internal/web/service/tgbot/tgbot_router.go @@ -1318,6 +1318,9 @@ func (t *Tgbot) answerCallback(callbackQuery *telego.CallbackQuery, isAdmin bool default: action, email, ok := splitClientLinkCallback(callbackQuery.Data) if !ok { + // Nothing matched: an unknown button still has to be answered, or it + // keeps spinning until Telegram times the callback out. + t.sendCallbackAnswerTgBot(callbackQuery.ID, t.I18nBot("tgbot.answers.errorOperation")) return } // The keyboard outlives the chat it was sent to, so the email in it @@ -1334,10 +1337,6 @@ func (t *Tgbot) answerCallback(callbackQuery *telego.CallbackQuery, isAdmin bool case "client_qr_links": t.sendClientQRLinks(chatId, email) } - - // Nothing matched: an unknown button still has to be answered, or it - // keeps spinning until Telegram times the callback out. - t.sendCallbackAnswerTgBot(callbackQuery.ID, t.I18nBot("tgbot.answers.errorOperation")) } }