snapshot: preserve account profile inline editing and avatar flow
This commit is contained in:
@@ -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'),
|
||||
|
||||
Reference in New Issue
Block a user