[DO NOT MERGE] add email notification system#1030
Conversation
|
Sorry for taking a while to get back to review this. A few high-level thoughts:
Regarding the notifications, I was thinking that rather than configuring recipients and events in the root config, those ideally are configured in the CMS UI somewhere, e.g. so users can "manage notifications", with "email" being one notification channel. I'm not entirely sure where this would be configured, maybe a mix of the action logs page and the settings page (and ideally users have a way to control their own notifications, similar to an app like Asana provides). |
|
re: (2) i think the "system" you're referring to may be related to this: #897. i can refactor so that users need to register an "email provider" and the email provider plugin has its own client utilities. for the larger notification system maybe we need to come up with some ux mocks and flesh out the requirements some more. |
|
prompt used: |
|
FYI ignore this PR, I may abandon it soon and start a new session. I forgot that you recently added a "translations service" and I wanna make sure that all the different "services" we have in the system have a consistent interface and configuration style. I'm gonna start a new session that plans this out better and if there are any changes to the translations API I can automatically have it convert to the new format so that your usage doesn't break when you upgrade to the new version. |
|
closed in favor of #1085 |

Changes Made
Phase 1: Renamed$\rightarrow$
apps/gcitoolsapp.yaml— service namegcitoolsgo.mod— module path totoolsdeploy.sh— description textPhase 2–3: Email config + Firestore queue (
root-cms)plugin.ts— AddedCMSEmailConfiginterface andemail?: CMSEmailConfigtoCMSPluginOptionswith options forenabled,sender,recipients(supports"ADMINS"sentinel),events, andwebhookclient.ts— Added:QueuedEmail,EmailStatus,QueueEmailOptionsinterfaces for theProjects/{id}/EmailsFirestore collectionqueueEmail()— writes a pending email doc to FirestorelistPendingEmails()— queries emails withstatus == 'pending'updateEmailStatus()— updates status tosent/failedresolveEmailRecipients()— resolves"ADMINS"to actual admin emails from ACLqueueEmailForAction()— auto-generates email subject/body from action datafireEmailWebhook()— fire-and-forget HTTP POST with HMAC-SHA256 signaturelogAction()to auto-queue emails whenemail.enabledand the action matches a configured eventPhase 4: Email sending handler (
tools)main.go— Added/_/send_emails?projectId=handler that:Projects/{projectId}/Emailswherestatus == "pending"via Firestoremail.Send)sent(withsentAt) orfailed(witherror)sent/failedcountsUsage example
fixes #858