mirror of
https://github.com/coder/coder.git
synced 2025-07-15 22:20:27 +00:00
chore: although unfortunate, it is possible for a user to be in no orgs (#13956)
This commit is contained in:
@ -3006,9 +3006,6 @@ func (q *FakeQuerier) GetOrganizationIDsByMemberIDs(_ context.Context, ids []uui
|
|||||||
OrganizationIDs: userOrganizationIDs,
|
OrganizationIDs: userOrganizationIDs,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if len(getOrganizationIDsByMemberIDRows) == 0 {
|
|
||||||
return nil, sql.ErrNoRows
|
|
||||||
}
|
|
||||||
return getOrganizationIDsByMemberIDRows, nil
|
return getOrganizationIDsByMemberIDRows, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1293,9 +1293,12 @@ func userOrganizationIDs(ctx context.Context, api *API, user database.User) ([]u
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return []uuid.UUID{}, err
|
return []uuid.UUID{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If you are in no orgs, then return an empty list.
|
||||||
if len(organizationIDsByMemberIDsRows) == 0 {
|
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]
|
member := organizationIDsByMemberIDsRows[0]
|
||||||
return member.OrganizationIDs, nil
|
return member.OrganizationIDs, nil
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user