fix: sync squads to Remnawave panel on tariff purchase/switch

When sync_squads parameter was introduced (4aaf0ddd) to prevent FK
violations from stale squad UUIDs, all update_remnawave_user calls
defaulted to sync_squads=False. This broke squad synchronization for
purchase/tariff-change flows where squads are freshly assigned and
must be sent to the panel.

Adds sync_squads=True to all purchase, tariff switch, and country
selection call sites across cabinet, bot handlers, miniapp, and
auto-purchase service.
This commit is contained in:
Fringg
2026-03-17 22:17:35 +03:00
parent 72b5305b87
commit c34fdd10a0
5 changed files with 9 additions and 2 deletions

View File

@@ -5691,7 +5691,7 @@ async def update_subscription_servers_endpoint(
pass
service = SubscriptionService()
await service.update_remnawave_user(db, subscription)
await service.update_remnawave_user(db, subscription, sync_squads=True)
await with_admin_notification_service(
lambda service: service.send_subscription_update_notification(
@@ -6500,6 +6500,7 @@ async def purchase_tariff_endpoint(
subscription,
reset_traffic=True,
reset_reason='покупка тарифа (miniapp)',
sync_squads=True,
)
# Сохраняем корзину для автопродления
@@ -6873,6 +6874,7 @@ async def switch_tariff_endpoint(
subscription,
reset_traffic=should_reset_traffic,
reset_reason='смена тарифа',
sync_squads=True,
)
except Exception as e:
logger.error('Ошибка синхронизации с RemnaWave при смене тарифа', error=e)