From 738590a26507ee53710045bfe0be96e2a05ee0f8 Mon Sep 17 00:00:00 2001 From: Vladless Date: Sat, 29 Mar 2025 12:03:56 +0300 Subject: [PATCH] add back button --- handlers/keys/key_management.py | 2 +- handlers/keys/keys.py | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/handlers/keys/key_management.py b/handlers/keys/key_management.py index ac9c4c42..5b76b0b7 100644 --- a/handlers/keys/key_management.py +++ b/handlers/keys/key_management.py @@ -302,7 +302,6 @@ async def create_key( return builder = InlineKeyboardBuilder() - builder.row(InlineKeyboardButton(text=SUPPORT, url=SUPPORT_CHAT_URL)) if CONNECT_PHONE_BUTTON: builder.row(InlineKeyboardButton(text=CONNECT_PHONE, callback_data=f"connect_phone|{key_name}")) builder.row( @@ -316,6 +315,7 @@ async def create_key( callback_data=f"connect_device|{key_name}", ) ) + builder.row(InlineKeyboardButton(text=SUPPORT, url=SUPPORT_CHAT_URL)) builder.row(InlineKeyboardButton(text=MAIN_MENU, callback_data="profile")) expiry_time_local = expiry_time.replace(tzinfo=None).astimezone(moscow_tz) diff --git a/handlers/keys/keys.py b/handlers/keys/keys.py index fddbdcdf..7fb07aff 100644 --- a/handlers/keys/keys.py +++ b/handlers/keys/keys.py @@ -182,11 +182,15 @@ def build_keys_response(records): async def handle_rename_key(callback: CallbackQuery, state: FSMContext): client_id = callback.data.split("|")[1] await state.set_state(RenameKeyState.waiting_for_new_alias) - await state.update_data(client_id=client_id, target_message=callback.message) + builder = InlineKeyboardBuilder() + builder.row(InlineKeyboardButton(text=BACK, callback_data="view_keys")) + await edit_or_send_message( - target_message=callback.message, text="✏️ Введите новое имя подписки (до 10 символов):", reply_markup=None + target_message=callback.message, + text="✏️ Введите новое имя подписки (до 10 символов):", + reply_markup=builder.as_markup() ) @@ -688,6 +692,7 @@ async def process_callback_connect_ios(callback_query: CallbackQuery): builder.row(InlineKeyboardButton(text=DOWNLOAD_IOS_BUTTON, url=DOWNLOAD_IOS)) builder.row(InlineKeyboardButton(text=IMPORT_IOS, url=f"{CONNECT_IOS}{key_link}")) builder.row(InlineKeyboardButton(text=MANUAL_INSTRUCTIONS, callback_data="instructions")) + builder.row(InlineKeyboardButton(text=BACK, callback_data=f"view_key|{email}")) builder.row(InlineKeyboardButton(text=MAIN_MENU, callback_data="profile")) await edit_or_send_message( @@ -726,6 +731,7 @@ async def process_callback_connect_android(callback_query: CallbackQuery): builder.row(InlineKeyboardButton(text=DOWNLOAD_ANDROID_BUTTON, url=DOWNLOAD_ANDROID)) builder.row(InlineKeyboardButton(text=IMPORT_ANDROID, url=f"{CONNECT_ANDROID}{key_link}")) builder.row(InlineKeyboardButton(text=MANUAL_INSTRUCTIONS, callback_data="instructions")) + builder.row(InlineKeyboardButton(text=BACK, callback_data=f"view_key|{email}")) builder.row(InlineKeyboardButton(text=MAIN_MENU, callback_data="profile")) await edit_or_send_message(