Repository navigation
Complete the admin email sending flow - #285
Conversation
Empty recipient lists no longer fall through to the whole organization, and send success or failure stays visible in the composer.
Keep the admin send rules and the success toast from main.
❌ Deploy Preview for servicestart failed. Why did it fail? →
|
✅ Deploy Preview for servicestart ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Disclaimer: This comment was AI-generated and is not necessarily completely accurate. Please take code comments with a grain of salt.
|
| zValidator("json", sendEmailSchema, (result, c) => { | ||
| if (!result.success) { | ||
| return c.json( | ||
| { error: result.error.issues[0]?.message ?? "Invalid email" }, | ||
| 400, | ||
| ); | ||
| } |
There was a problem hiding this comment.
| if (!result.success) { | ||
| throw new Error("Failed to send email"); | ||
| } |
There was a problem hiding this comment.
Failed delivery leaves saved records
If the email provider returns success: false, this new throw reaches the announcement and message callers after they have saved their records. Their requests then fail even though the records remain: retrying publication cannot resend an already-published announcement, and retrying message creation risks duplicate work. Delivery failure needs to be handled together with those writes.
| <p className="text-desktop-paragraph-2! leading-5.5! font-bold! font-paragraph! text-grey-text-strong"> | ||
| Please Confirm Deletion | ||
| </p> | ||
| } | ||
| description={ | ||
| <p className="!text-mobile-paragraph-2 !leading-[20px] !font-paragraph text-grey-text-weak"> | ||
| <p className="text-mobile-paragraph-2! leading-5! font-paragraph! text-grey-text-weak"> |
There was a problem hiding this comment.
Deletion modals violate typography requirements
The changed title and description classes use paragraph styles and grey text. The repository requires modal titles to use responsive heading-1 variables, descriptions to use paragraph-1 variables, and both to use white text. The batch-deletion modal repeats this pattern; this requirement must be satisfied before merging.
Rule Used: Modal titles should use the heading-1 CSS variables from src/styles/globals.css for font-size, font-family, and line-height (responsive for desktop and mobile). Modal descriptions should use the paragraph-1 CSS variables from the same file. Bot... (source)
Learned From
GTBitsOfGood/design-system#76
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
emailMembers now threw when Juno reported an unsuccessful send, which turned announcement publishing and message creation into 500s after their rows were already saved. Return a result (sent, no-recipients, delivery-failed) instead, and let POST /api/emails map it to 400/500. Other callers keep their previous behavior. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VeYmbN1aRFTdeZM8vU2cC3
|
Pushed c055fa8 for Greptile's P1 "Failed delivery leaves saved records". Left as-is:
Generated by Claude Code |
Closes #99
Checklist:
Description
Admins and owners can compose an email from the inbox, choose recipients in the active organization, and see whether the send succeeded or failed. An empty recipient list is rejected instead of mailing the whole organization. While a send is in flight the composer stays open and cannot be submitted again. A failed send keeps the draft so it can be retried.
Changes Made
POST /api/emailsenforces admin access, validation, and tenant isolation. Unit and end-to-end tests cover those cases, plus member, guest, pending, and owner viewpoints.Screenshots/Videos
Admin sends successfully
admin-sends-successfully.webm
Failed send, draft stays, then retry
failed-send-retry.webm
Member sees the inbox with no New button
member-no-new.webm
Guest is sent to login
guest-to-login.webm
Pending join request is sent away from the inbox
pending-join.webm
Owner opens the composer
owner-opens-composer.webm
Teammate is listed and a member of another organization is not
teammate-not-other-org.webm
QA Steps
Related Tickets