mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08: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,
|
||||
})
|
||||
}
|
||||
if len(getOrganizationIDsByMemberIDRows) == 0 {
|
||||
return nil, sql.ErrNoRows
|
||||
}
|
||||
return getOrganizationIDsByMemberIDRows, nil
|
||||
}
|
||||
|
||||
|
||||
+4
-1
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user