Skip to content

Commit 064fae8

Browse files
fix(review): only surface active/purchased member orgs for foundation auditors (LFXV2-2750)
Signed-off-by: Manish Dixit <mdixit@linuxfoundation.org>
1 parent 1763179 commit 064fae8

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

apps/lfx-one/src/server/services/foundation-auditor-orgs.service.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ export function isFoundationAuditorOrgSelectorEnabled(): boolean {
4848
* single requests hitting gateway URL-length / access-check batch limits.
4949
*/
5050
export class FoundationAuditorOrgsService {
51+
// Active membership statuses (case-insensitive) — mirrors OrgMembershipResolverService and
52+
// OrgPeopleKeyContactsService so terminated/expired memberships don't surface stale member orgs.
53+
private static readonly activeMembershipStatuses = new Set(['active', 'purchased']);
54+
5155
private readonly microserviceProxy: MicroserviceProxyService;
5256
private readonly accessCheck: AccessCheckService;
5357

@@ -167,7 +171,11 @@ export class FoundationAuditorOrgsService {
167171
for (const memberships of membershipsByIndex) {
168172
for (const membership of memberships ?? []) {
169173
const uid = membership.b2b_org_uid;
170-
if (!uid || seen.has(uid) || !isFilterSafeIdentifier(uid)) continue;
174+
if (!uid || !isFilterSafeIdentifier(uid)) continue;
175+
// Only active/purchased memberships count — an org with a terminated membership is no longer a
176+
// member. Status is checked BEFORE dedup so a stale row can't shadow the same org's active row.
177+
if (!FoundationAuditorOrgsService.activeMembershipStatuses.has((membership.status ?? '').toLowerCase())) continue;
178+
if (seen.has(uid)) continue;
171179
seen.add(uid);
172180
orderedUids.push(uid);
173181
if (orderedUids.length >= FOUNDATION_AUDITOR_MEMBER_ORGS_HARD_CAP) {

0 commit comments

Comments
 (0)