Skip to content

feat(comments): email the workspace owner and admins when a comment arrives - #401

Merged
ABB65 merged 1 commit into
mainfrom
feat/comment-notification
Oct 3, 2026
Merged

ABB65 merged 1 commit into
mainfrom
feat/comment-notification

Conversation

@ABB65

@ABB65 ABB65 commented Oct 3, 2026

Copy link
Copy Markdown
Member

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) through useEmailProvider (Resend), one mail each, errors swallowed.
  • Two templates in the email-templates collection: comment-pending (asks for review) and comment-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.
  • Called fire-and-forget after 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.
  • Model flag comments.notifications, default on, toggle in Comments Settings (comments.notifications strings), documented in docs/COMMENTS.md.
  • resolvePublicCommentContext now 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 on forms.notifications; a comments.notifications plan row would be a pricing-page change, so I left it out. Say if it should follow forms.

Tests

  • comment-routes integration: pending asks for review (escaped, link, both recipients), auto-approved says published, notifications: false sends nothing.
  • comment-types unit: the flag defaults on.
  • pnpm test:ci ran 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.

…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.
@ABB65

ABB65 commented Oct 3, 2026

Copy link
Copy Markdown
Member Author

ONAY (t6) — 5ccea0c

  • Core/ee sınırı: hasFeature kapısı yok, ee importu yok; notifyFormSubmission ile aynı örüntü, çekirdekte.
  • Ayar: model patch rotasındaki {...current, ...body.comments} birleşimi + normalizeCommentsConfig ile notifications kalıcı.
  • İçerik HTML-escape ediliyor; proje bağlantı rotası mevcut.
  • Testler: unit 10/10 dosya 81/81; integration 50 dosya 470 test; nuxt 43 dosya 274 test; eslint + vue-tsc temiz. (Yük kaynaklı zaman aşımları uzun timeout ile tek tek yeniden koşuldu, geçti.)
  • Not (bloklamaz): mevcut yorum modellerinde varsayılan açık geliyor; sahip/yöneticiler yeni e-posta almaya başlar.

@ABB65
ABB65 merged commit 8eadd9a into main Oct 3, 2026
2 checks passed
@ABB65
ABB65 deleted the feat/comment-notification branch October 3, 2026 13:57
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.

1 participant