mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-09-16 15:17:14 +00:00
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.
This commit is contained in:
@@ -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"))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user