snapshot: preserve account profile inline editing and avatar flow

This commit is contained in:
Md Bayazid Bostame
2026-03-27 02:06:52 +01:00
parent 8d228723f9
commit 358a71230d
13 changed files with 1462 additions and 398 deletions

View File

@@ -131,9 +131,16 @@ def user_has_capability(user, capability: str) -> bool:
def template_role_context(user) -> dict[str, object]:
role_key = get_user_role_key(user)
avatar_url = ''
if getattr(user, 'is_authenticated', False):
profile = getattr(user, 'profile', None)
avatar = getattr(profile, 'avatar_image', None)
if avatar:
avatar_url = getattr(avatar, 'url', '') or ''
return {
'role_key': role_key,
'role_label': str(ROLE_LABELS[role_key]),
'user_avatar_url': avatar_url,
'can_manage_product_branding': user_has_capability(user, 'manage_product_branding'),
'can_manage_company_config': user_has_capability(user, 'manage_company_config'),
'can_manage_trial_lifecycle': user_has_capability(user, 'manage_trial_lifecycle'),