From 565734a34d465d87d8862243a0b8a8a010cba9a3 Mon Sep 17 00:00:00 2001 From: Rui Tome Date: Mon, 3 Aug 2026 14:48:45 +0100 Subject: [PATCH] =?UTF-8?q?[PM-38270]=20perf:=20Replace=20O(n=C2=B2)=20Any?= =?UTF-8?q?()=20scan=20with=20HashSet=20in=20GetOrganizationUsersClaimedSt?= =?UTF-8?q?atusQuery?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../GetOrganizationUsersClaimedStatusQuery.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Core/AdminConsole/OrganizationFeatures/OrganizationUsers/GetOrganizationUsersClaimedStatusQuery.cs b/src/Core/AdminConsole/OrganizationFeatures/OrganizationUsers/GetOrganizationUsersClaimedStatusQuery.cs index a857ef230811..2f23b68f10f4 100644 --- a/src/Core/AdminConsole/OrganizationFeatures/OrganizationUsers/GetOrganizationUsersClaimedStatusQuery.cs +++ b/src/Core/AdminConsole/OrganizationFeatures/OrganizationUsers/GetOrganizationUsersClaimedStatusQuery.cs @@ -26,11 +26,10 @@ public async Task> GetUsersOrganizationClaimedStatusAsyn if (organizationAbility is { Enabled: true, UseOrganizationDomains: true }) { - // Get all organization users with claimed domains by the organization var organizationUsersWithClaimedDomain = await _organizationUserRepository.GetManyByOrganizationWithClaimedDomainsAsync(organizationId); - // Create a dictionary with the OrganizationUserId and a boolean indicating if the user is claimed by the organization - return organizationUserIds.ToDictionary(ouId => ouId, ouId => organizationUsersWithClaimedDomain.Any(ou => ou.Id == ouId)); + var claimedIds = organizationUsersWithClaimedDomain.Select(ou => ou.Id).ToHashSet(); + return organizationUserIds.ToDictionary(ouId => ouId, claimedIds.Contains); } }