Skip to content

Email Users: the READONLY_ADMIN group option always fails with a 400 #653

Description

@costacalvin

Description

The Email Users modal offers a READONLY_ADMIN option in the recipient-group dropdown, but the backend does not accept that group. Selecting it always fails with a 400, and the admin sees only a generic "try again" snackbar with no indication that the option can never work.

src/components/EmailModal/EmailModal.tsx:185-188 lists READONLY_ADMIN among the dropdown options. The backend's massEmailGroups map in internal/model/massemails.go:17-24 contains only ISSO, ISSM, SYSTEM_DELEGATE, DCC, ALL, and ADMIN. A group outside that map fails isValid() and returns 400.

Steps to Reproduce

  1. Sign in as an OWNER or HHS_ADMIN
  2. Open the "..." menu in the header and choose "Email Users"
  3. In "Select the group to email", choose READONLY_ADMIN
  4. Fill in a subject and body, then click Send
  5. See the generic error snackbar; no email is sent

Expected Behavior

Either the group is a valid audience and the send succeeds, or it is not offered in the dropdown at all. A user should never be presented with a choice that cannot succeed.

Actual Behavior

The API returns 400. The frontend catches it and shows only ERROR_MESSAGES.tryAgain, so the admin has no way to tell that the failure is permanent rather than transient — retrying will fail identically every time.

Environment

Any browser; reproducible in all environments. Frontend EmailModal.tsx against the /api/v1/massemails endpoint.

Acceptance Criteria

  • READONLY_ADMIN is no longer offered in the group dropdown
  • Every remaining dropdown option maps to a key in the backend's massEmailGroups and sends successfully
  • A test asserts the dropdown options match the backend's accepted groups, so the two cannot drift apart again
  • No regression in the existing EmailModal.test.tsx suite

Severity

Medium - Affects functionality but has workaround

Affected Component

Email Users modal (src/components/EmailModal/EmailModal.tsx)

Workaround

Choose ADMIN instead, which reaches the OWNER, HHS_ADMIN, and OPDIV_ADMIN tiers. There is no way to email read-only admins, by design.

Additional Context

Part of epic CMS-Enterprise/ztmf#503, but independent of that epic's sequencing — this can ship at any time, including immediately.

The fix is to remove the dropdown option, not to add the group to the backend. The backend exclusion is deliberate and documented in a comment at internal/model/massemails.go:151-156: read-only admin tiers are intentionally excluded for parity with pre-multi-OpDiv behavior, which emailed only ADMIN and never READONLY_ADMIN. The ADMIN key there is an audience selector in the API contract, not a user role.

Labeled needs-refinement.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/frontendUI components, layer cake, modals, searchbugSomething isn't workingneeds-refinementUsed on tickets that need to be refined before work.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions