fix: pass links/is_promotion to _summary_keyboard in cancel and send_reply handlers
This commit is contained in:
@@ -404,10 +404,12 @@ def _handle_callback(tg_cfg: TelegramConfig, cfg: Config, cb: dict):
|
|||||||
send_text(tg_cfg, str(chat_id), f"✅ 回复已发送")
|
send_text(tg_cfg, str(chat_id), f"✅ 回复已发送")
|
||||||
delete_conversation(chat_id)
|
delete_conversation(chat_id)
|
||||||
can_reply = ctx.get("can_reply", True)
|
can_reply = ctx.get("can_reply", True)
|
||||||
|
is_promotion = ctx.get("summary_data", {}).get("category") == "promotion"
|
||||||
|
links = ctx.get("summary_data", {}).get("links", [])
|
||||||
_tg_req(tg_cfg, "editMessageText", {
|
_tg_req(tg_cfg, "editMessageText", {
|
||||||
"chat_id": chat_id, "message_id": msg_id,
|
"chat_id": chat_id, "message_id": msg_id,
|
||||||
"text": ctx["summary_text"], "parse_mode": "MarkdownV2",
|
"text": ctx["summary_text"], "parse_mode": "MarkdownV2",
|
||||||
"reply_markup": _summary_keyboard(can_reply),
|
"reply_markup": _summary_keyboard(can_reply, is_promotion, links),
|
||||||
})
|
})
|
||||||
|
|
||||||
elif action == CALLBACK_SELECT_REPLY and ctx:
|
elif action == CALLBACK_SELECT_REPLY and ctx:
|
||||||
@@ -475,10 +477,12 @@ def _handle_callback(tg_cfg: TelegramConfig, cfg: Config, cb: dict):
|
|||||||
ctx["summary_data"]["reply_suggestions"] = []
|
ctx["summary_data"]["reply_suggestions"] = []
|
||||||
save_email_context(msg_id, ctx)
|
save_email_context(msg_id, ctx)
|
||||||
can_reply = ctx.get("can_reply", True)
|
can_reply = ctx.get("can_reply", True)
|
||||||
|
is_promotion = ctx.get("summary_data", {}).get("category") == "promotion"
|
||||||
|
links = ctx.get("summary_data", {}).get("links", [])
|
||||||
_tg_req(tg_cfg, "editMessageText", {
|
_tg_req(tg_cfg, "editMessageText", {
|
||||||
"chat_id": chat_id, "message_id": msg_id,
|
"chat_id": chat_id, "message_id": msg_id,
|
||||||
"text": ctx["summary_text"], "parse_mode": "MarkdownV2",
|
"text": ctx["summary_text"], "parse_mode": "MarkdownV2",
|
||||||
"reply_markup": _summary_keyboard(can_reply),
|
"reply_markup": _summary_keyboard(can_reply, is_promotion, links),
|
||||||
})
|
})
|
||||||
logger.info(" 取消, 恢复摘要视图")
|
logger.info(" 取消, 恢复摘要视图")
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user