Skip to content

Feat: Show email delivery status on ContractAdminPage seat table - #3733

Open
daniellefrappier18 wants to merge 3 commits into
mainfrom
daniellef/add-email-status-b2b-admin
Open

Feat: Show email delivery status on ContractAdminPage seat table#3733
daniellefrappier18 wants to merge 3 commits into
mainfrom
daniellef/add-email-status-b2b-admin

Conversation

@daniellefrappier18

@daniellefrappier18 daniellefrappier18 commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

What are the relevant tickets?

Description (What does it do?)

Replaces the binary "Pending claim"/"Redeemed" status pill on the Contract Admin seat table with the new per-seat email delivery status (Pending/Delivered/Opened/Clicked/Failed), while keeping "Redeemed" behavior unchanged.

  • getDisplayStatus() merges redemption_status + email_status into one displayed value: redeemed always wins; otherwise a null/"pending" email_status collapses to plain "Pending," and delivered/opened/clicked render as "Pending - X" since the seat is still unredeemed.
  • Pill colors: green (Redeemed), red (Failed), blue (everything else).
  • Failed pills get a warning icon and an accessible tooltip explaining possible causes (no per-record failure reason is available from the API yet — SMTP/error-level detail is deferred to a later pass)
  • Drops "claim" from the status pill, header stat label, tab label, and CSV export column.

Screenshots (if appropriate):

  • Desktop screenshots
  • Mobile width screenshots
Screenshot 2026-08-06 at 3 48 43 PM Screenshot 2026-08-06 at 3 41 48 PM

How can this be tested?

Local-dev testing walkthrough (Tilt / ol-infrastructure)

This assumes the feat/openedx-tilt-local-dev k3d+Tilt stack from ol-infrastructure, with mitxonline enabled. A couple of things surfaced while I was testing this that are worth calling out to whoever picks this up:

Setup

  1. yarn install after pulling this branch — it bumps @mitodl/mitxonline-api-axios to 2026.8.6.
  2. Confirm your kubectl context is on the local-dev cluster: kubectl config current-contextlocal-dev.
  3. Assign a seat to a test email via the ContractAdminPage UI (or mitxonline's b2b admin dash) — this creates the DiscountContractAttachmentRedemption row you'll edit below.

Fastest path — verify every pill/color/tooltip directly (bypasses email sending entirely):

Find the record's id:

```bash
kubectl exec -n mitxonline deploy/mitxonline-webapp -c app -- python manage.py shell -c "
from b2b.models import DiscountContractAttachmentRedemption
print(list(DiscountContractAttachmentRedemption.objects.filter(assigned_email='YOUR_TEST_EMAIL').values('id', 'email_status')))
"

Then set whichever status you want to check (pending, delivered, opened, clicked, or failed):

kubectl exec -n mitxonline deploy/mitxonline-webapp -c app -- python manage.py shell -c "
from b2b.models import DiscountContractAttachmentRedemption
from django.utils import timezone
r = DiscountContractAttachmentRedemption.objects.get(id=<record_id>)
r.email_status = '<status>'
r.email_status_event_timestamp = timezone.now()
r.save()
"

Refresh ContractAdminPage and confirm: correct label text ("Pending", "Pending - Delivered/Opened/Clicked", or "Failed"), correct pill color, and — for failed — the warning icon and tooltip (hover and keyboard-focus the pill; the explanation should be announced as a description, not replace the "Failed" name).

Additional Context

@daniellefrappier18
daniellefrappier18 marked this pull request as ready for review August 10, 2026 14:00
Copilot AI balanced review requested due to automatic review settings August 10, 2026 14:00

Copilot AI 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.

Pull request overview

Adds per-seat email delivery status to the contract administration seat table.

Changes:

  • Displays delivery states with status-specific pills and an accessible failure tooltip.
  • Updates status labels and CSV exports.
  • Upgrades the MITx Online API client and related factories.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
yarn.lock Locks the upgraded API client.
frontends/main/package.json Upgrades the MITx Online client.
frontends/api/package.json Upgrades shared API dependency.
ContractAdminPage.tsx Adds delivery-status display and export logic.
ContractAdminPage.test.tsx Tests status pills and updated labels.
OrganizationCards.test.tsx Adds the required SSO organization field.
factories/organization.ts Supplies the new organization field.
factories/contracts.ts Supplies email-status fields.
Suppressed comments (1)

frontends/main/src/app-pages/ContractAdminPage/ContractAdminPage.test.tsx:919

  • Filtering getByText with the internal .MuiChip-label class couples this test to MUI markup, contrary to the frontend testing guideline to query by role/label/text rather than classes. Scope the visible “Pending” assertion to its table row or status cell using semantic queries.
      expect(
        screen.getByText("Pending", { selector: ".MuiChip-label" }),
      ).toBeInTheDocument()

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread frontends/main/src/app-pages/ContractAdminPage/ContractAdminPage.test.tsx Outdated
Comment thread frontends/api/package.json
…eries, Failed-pill focus coverage, drop resolved sso_organization_id workaround
@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown

OpenAPI Changes

No changes detected

View full changelog

Unexpected changes? Ensure your branch is up-to-date with main (consider rebasing).

@dsubak
dsubak self-requested a review August 10, 2026 23:47
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.

2 participants