fix: refresh user subscription after gift activation in /start

After svc_activate creates a subscription, the user object still
has stale cached data. Refresh the subscription attribute so the
main menu immediately shows the active subscription status.
This commit is contained in:
Fringg
2026-03-10 06:36:33 +03:00
parent 0005d59da1
commit 363ccce56d
+2
View File
@@ -640,6 +640,8 @@ async def cmd_start(message: types.Message, state: FSMContext, db: AsyncSession,
if user:
await _activate_pending_gift_after_registration(db, state, user, message.answer)
await state.update_data(pending_gift_token=None)
# Refresh user to pick up newly created subscription
await db.refresh(user, attribute_names=['subscription'])
has_active_subscription, subscription_is_active = _calculate_subscription_flags(user.subscription)