From 422043023e4848b1da0522078e2a5f7333fca361 Mon Sep 17 00:00:00 2001 From: Suejung Shin Date: Fri, 10 Jan 2025 09:30:11 -0800 Subject: [PATCH] account for empty list --- graphql_api/types/query/query.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/graphql_api/types/query/query.py b/graphql_api/types/query/query.py index db4309c227..ab4064130d 100644 --- a/graphql_api/types/query/query.py +++ b/graphql_api/types/query/query.py @@ -51,9 +51,13 @@ async def resolve_owner( if settings.IS_ENTERPRISE and settings.GUEST_ACCESS is False: if not user or not user.is_authenticated: raise UnauthorizedGuestAccess() + + # if the owner tracks plan activated users, check if the user is in the list target_owner = await get_owner(service, username) has_plan_activated_users = ( - target_owner and target_owner.plan_activated_users is not None + target_owner + and target_owner.plan_activated_users is not None + and len(target_owner.plan_activated_users) > 0 ) if ( has_plan_activated_users