Scope the rich message button guard to the message

Task: 2026/07/30/scope-rich-button-guard-to-message
This commit is contained in:
John Preston
2026-07-31 17:29:30 +04:00
parent 6395635e5e
commit 0119285832
11 changed files with 101 additions and 45 deletions

View File

@@ -638,4 +638,28 @@ void ActivateBotCommand(ClickHandlerContext context, int row, int column) {
});
}
void ActivateRichPageBotButton(
ClickHandlerContext context,
const HistoryMessageMarkupButton &button) {
const auto strong = context.sessionWindow.get();
if (!strong) {
return;
}
const auto owner = &strong->session().data();
const auto itemId = context.itemId;
const auto key = HistoryMessageMarkupButton::RegisterRichPageButton(
owner,
itemId,
button);
if (key.isEmpty()) {
return;
}
ActivateBotButton(context, [=] {
return HistoryMessageMarkupButton::GetRichPageButton(
owner,
itemId,
key);
});
}
} // namespace Api