fix(membership): show only the newest application per applicant #52
No reviewers
Labels
No labels
bug
discussion
enhancement
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
edufeed/edufeed-app!52
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/membership-latest-application"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Kind 1069 is a regular event, so re-submitting a membership application adds a copy rather than replacing the original. Both admin-facing surfaces counted and rendered raw events, so an applicant who edited their application appeared once per submission.
Found by TestOER while browser-testing dev @
2f507ff5.Why this is more than a cosmetic count
The badge double-count was the visible symptom. The sharper problem is in the approvals panel:
approve()provisionsdecrypted.get(response.id).wished_handle— the handle from that row. With a superseded row still listed and still actionable, an admin approving the wrong card provisions the handle the applicant asked for before they edited it, and/api/nip05has no reason to reject it.The change
Both surfaces now go through a new
selectAdminApplications()helper, which does the per-admin p-tag narrowing they already duplicated, plus a newest-per-applicant reduction. Ties oncreated_atbreak by event id so the choice does not depend on relay arrival order.The reduction runs before the rejected-id filter: rejection means "reject this applicant", so rejecting the row the admin actually saw must not resurface an older submission from the same person. There is a test pinning that ordering.
Verification
.envexported so thepublish-forms-buildtests can readSCHEME_NADDR_*.pnpm lintclean,pnpm check0 errors (4 pre-existing warnings in test fixtures).