chore: although unfortunate, it is possible for a user to be in no orgs (#13956)

This commit is contained in:
Steven Masley
2024-07-22 05:39:50 -10:00
committed by GitHub
parent 005254d64a
commit dd99457a04
2 changed files with 4 additions and 4 deletions

View File

@ -1293,9 +1293,12 @@ func userOrganizationIDs(ctx context.Context, api *API, user database.User) ([]u
if err != nil {
return []uuid.UUID{}, err
}
// If you are in no orgs, then return an empty list.
if len(organizationIDsByMemberIDsRows) == 0 {
return []uuid.UUID{}, xerrors.Errorf("user %q must be a member of at least one organization", user.Email)
return []uuid.UUID{}, nil
}
member := organizationIDsByMemberIDsRows[0]
return member.OrganizationIDs, nil
}