From b23b75b72e3eb8b126ceaa32179a70b10e936fbd Mon Sep 17 00:00:00 2001 From: machka-pasla Date: Mon, 25 Aug 2025 12:24:30 +0300 Subject: [PATCH] Refactor username update logic in SubscriptionService to prevent overwriting Telegram usernames - Removed the conditional logic that updated the local user's username with the panel username, ensuring that the Telegram username remains unchanged. - Added a comment to clarify the purpose of the update, focusing on maintaining the linkage to the panel UUID. --- bot/services/subscription_service.py | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/bot/services/subscription_service.py b/bot/services/subscription_service.py index f9557c2..12e9377 100644 --- a/bot/services/subscription_service.py +++ b/bot/services/subscription_service.py @@ -232,23 +232,10 @@ class SubscriptionService: "panel_user_uuid": actual_panel_uuid_from_api } - if ( - actual_panel_username_from_api - and actual_panel_username_from_api - != panel_username_on_panel_standard - and ( - db_user.username is None - or db_user.username != actual_panel_username_from_api - ) - ): - update_data_for_local_user["username"] = ( - actual_panel_username_from_api - ) - + # Do not overwrite Telegram username with panel username. + # Only update the local linkage to panel UUID here. await user_dal.update_user(session, user_id, update_data_for_local_user) db_user.panel_user_uuid = actual_panel_uuid_from_api - if "username" in update_data_for_local_user: - db_user.username = update_data_for_local_user["username"] panel_user_created_or_linked_now = True current_local_panel_uuid = actual_panel_uuid_from_api else: