Skip to content

CRASM-3605 Retired Organization Displaying On Dashboard#1519

Merged
cduhn17 merged 2 commits into
developfrom
kk_crasm_3605_retired_org_remove_from_display
Jul 1, 2026
Merged

CRASM-3605 Retired Organization Displaying On Dashboard#1519
cduhn17 merged 2 commits into
developfrom
kk_crasm_3605_retired_org_remove_from_display

Conversation

@kirakaplinski

@kirakaplinski kirakaplinski commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

🗣 Description

Updates:

  • Added shared active_organizations() helper so retired orgs are filtered consistently across API queries
  • Excluded retired orgs from organization list/search endpoints: GET /organizations, GET /organizations/region_id/{id}, GET /organizations/state/{state}, POST /v2/organizations/search
  • Return 404 for direct access to retired orgs via GET /organizations/{id}
  • Excluded retired orgs from scan admin org picker lists (GET /scans, GET /scans/{id})
  • Updated Elasticsearch org search (POST /search/organizations) to filter out retired: true documents
  • Updated ES org sync to index only active orgs, include retired on indexed docs, and delete retired orgs from the index
  • Added tests covering API endpoints, ES search query filtering, scan lists, and ES sync behavior

This update ensures that retired organizations are no longer displayed on the CyHy Dashboard front end. Previously, retired organizations were still included in API responses, causing them to appear in UI filters and results.
The organization filtering logic was updated in:
backend/src/xfd_django/xfd_api/helpers/filter_helpers.py
Specifically:
Added Q(retired=False) to the apply_organization_filters() function.
Ensures all organization queries automatically exclude retired entries.
No other filtering behavior was modified.

💭 Motivation and context

This change ensures that retired organizations are no longer visible on the CyHy Dashboard, improving data accuracy and preventing users from interacting with outdated organization records.

🧪 Testing

Before the change
Logged into the CyHy Dashboard.
Navigated to Admin Hub → Manage Orgs → Filters.
Searched for a known retired organization that has been set to retired in DB .
Result: The retired organization appeared in the search results, meaning the dashboard still displayed organizations marked as retired.

After the change
Repeated the same steps on the updated backend.
Searched for the same retired organization.
Result: The organization no longer appeared in the filter results.
Confirmed that active (non‑retired) organizations still appear correctly and all other filter functionality behaves as expected.

📷 Screenshots (if appropriate)

image

Before change:
image

After change:
image
image

✅ Pre-approval checklist

  • This PR has an informative and human-readable title.
  • Changes are limited to a single goal - eschew scope creep!
  • All future TODOs are captured in issues, which are referenced in code comments.
  • All relevant type-of-change labels have been added.
  • I have read the CONTRIBUTING document.
  • These code changes follow cisagov code standards.
  • All relevant repo and/or project documentation has been updated to reflect the changes in this PR.
  • Tests have been added and/or modified to cover the changes in this PR.
  • All new and existing tests pass.
  • Bump major, minor, patch, pre-release, and/or build versions as appropriate via the bump_version script if this repository is versioned and the changes in this PR warrant a version bump.
  • Create a pre-release (necessary if and only if the pre-release version was bumped).

✅ Pre-merge checklist

  • Revert dependencies to default branches.
  • Finalize version.

✅ Post-merge checklist

  • Create a release (necessary if and only if the version was bumped).

@cduhn17 cduhn17 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, bulk of this review was done 6/30 in PR review meeting.

@nickviola nickviola left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cduhn17 cduhn17 merged commit a700d19 into develop Jul 1, 2026
19 checks passed
@cduhn17 cduhn17 deleted the kk_crasm_3605_retired_org_remove_from_display branch July 1, 2026 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants