feat(comments): email the workspace owner and admins when a comment arrives - #401
Merged
Merged
Conversation
…rrives A public comment now notifies owner and accepted admins through the email provider, the way a form submission does: comment-pending asks for review, comment-published says an auto-approved one is live. The model's comments.notifications flag (default on, toggle in Comments Settings) turns it off. Best-effort and fire-and-forget; a mail failure never changes the visitor's response.
Member
Author
|
ONAY (t6) — 5ccea0c
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
E6 gap 2: a new comment arriving in Studio sent no email. A migrated WordPress site had that (moderation mail); a form submission already has it (
notifyFormSubmission), comments did not.What changes
notifyCommentSubmitted(server/utils/comment-notifications.ts) mirrors the form notifier: owner and accepted admins (listWorkspaceNotificationRecipients) throughuseEmailProvider(Resend), one mail each, errors swallowed.email-templatescollection:comment-pending(asks for review) andcomment-published(an auto-approved comment is already live). Author, entry, project and the excerpt (400 characters) are HTML-escaped; the link goes to the project, like the form mail.createCommentIfAllowed, so the visitor's response is unchanged whether or not the mail goes out. A honeypot hit, a refused or invalid comment never reaches it.comments.notifications, default on, toggle in Comments Settings (comments.notificationsstrings), documented indocs/COMMENTS.md.resolvePublicCommentContextnow also returns the workspace name and slug and the project's repository name.Decision for the founder
No new plan feature: the mail needs
comments.enabled(already required to take comments) and the model flag. Forms gate theirs onforms.notifications; acomments.notificationsplan row would be a pricing-page change, so I left it out. Say if it should follow forms.Tests
comment-routesintegration: pending asks for review (escaped, link, both recipients), auto-approved says published,notifications: falsesends nothing.comment-typesunit: the flag defaults on.pnpm test:ciran on a machine at load ~90, so about 50 unrelated 5 s timeouts (agent, billing, media) hit; the comment and license-parity suites pass (145 tests). CI is the real check for the rest.