Add email digest schedule controls to Alert Settings #5

Merged
matt merged 1 commit from flotilla-fc1-email-digests-let-users-choose-delivery--f63 into email-notifications 2026-09-23 20:37:16 +00:00
Collaborator

flotilla-fc1

Adds digest schedule controls to the Email Digest card in Alert Settings, letting users choose a daily or weekly delivery time with wall-clock timezone support. The schedule is sent to mailship via NIP-98 authenticated PUT /subscription/email and persisted cross-device through the existing AppData publishSettings path.

Changes

  • Extended SettingsValues in src/app/settings.ts with emailHour, emailMinute, emailDayOfWeek, and emailTimezone, defaulting to 17:00 daily in the device timezone. Persisted and synced through publishSettings/publishEmailSettings.
  • Created src/app/mail.ts — a Mail adapter class (Mail.register/Mail.unregister) that sends PUT/DELETE to mailship with the full subscription payload (email, frequency, hour, minute, dayOfWeek, timezone). Uses the same NIP-98 auth header pattern as hosting.ts.
  • Added the Email Digest card to src/routes/settings/alerts/+page.svelte with: enable toggle, email address input, daily/weekly frequency segmented toggle, HH:MM time picker, and a day-of-week selector (shown only for weekly). Mailship validation errors surface via the existing toast path.
  • Added VITE_MAILSHIP_URL env var for the mailship backend endpoint.

How to test

  1. Navigate to Settings → Alert Settings.
  2. Toggle "Enable email digest" on, enter an email address.
  3. Select "Daily" at 07:30 and save — verify no error toast appears.
  4. Switch to "Weekly", pick Saturday, set 09:00, save — verify the day picker appears and setting persists.
  5. Toggle email off, re-enable — verify the previous schedule fields are restored from AppData.
flotilla-fc1 Adds digest schedule controls to the Email Digest card in Alert Settings, letting users choose a daily or weekly delivery time with wall-clock timezone support. The schedule is sent to mailship via NIP-98 authenticated PUT /subscription/email and persisted cross-device through the existing AppData publishSettings path. **Changes** - Extended `SettingsValues` in `src/app/settings.ts` with `emailHour`, `emailMinute`, `emailDayOfWeek`, and `emailTimezone`, defaulting to 17:00 daily in the device timezone. Persisted and synced through `publishSettings`/`publishEmailSettings`. - Created `src/app/mail.ts` — a `Mail` adapter class (`Mail.register`/`Mail.unregister`) that sends PUT/DELETE to mailship with the full subscription payload (email, frequency, hour, minute, dayOfWeek, timezone). Uses the same NIP-98 auth header pattern as `hosting.ts`. - Added the Email Digest card to `src/routes/settings/alerts/+page.svelte` with: enable toggle, email address input, daily/weekly frequency segmented toggle, HH:MM time picker, and a day-of-week selector (shown only for weekly). Mailship validation errors surface via the existing toast path. - Added `VITE_MAILSHIP_URL` env var for the mailship backend endpoint. **How to test** 1. Navigate to Settings → Alert Settings. 2. Toggle "Enable email digest" on, enter an email address. 3. Select "Daily" at 07:30 and save — verify no error toast appears. 4. Switch to "Weekly", pick Saturday, set 09:00, save — verify the day picker appears and setting persists. 5. Toggle email off, re-enable — verify the previous schedule fields are restored from AppData.
hudson added 1 commit 2026-09-23 15:58:46 +00:00
feat(settings): add email digest schedule controls
All checks were successful
CI / lint-check-build (pull_request) Successful in 3m26s
5c4e07bb8d
Adds digest schedule controls to the Email Digest card in Alert Settings:
- emailHour, emailMinute, emailDayOfWeek, emailTimezone in SettingsValues
  persisted via AppData (publishSettings/publishEmailSettings)
- Mail adapter (src/app/mail.ts) with Mail.register/unregister that sends
  PUT/DELETE /subscription/email to mailship with NIP-98 auth
- UI: frequency toggle (daily/weekly), HH:MM time input, day-of-week picker
  (shown only for weekly), surface mailship errors via toast
- VITE_MAILSHIP_URL env var for the mailship backend
hudson changed target branch from dev to email-notifications 2026-09-23 16:03:50 +00:00
Author
Collaborator

@fragua resolve_conflicts guidance (PR retargeted: dev → email-notifications):

This branch was built against dev and duplicates the email-notifications feature. Resolution intent when integrating:

  • KEEP the email-notifications implementation: src/app/mail/index.ts (Mail adapter), VITE_EMAIL_NOTIFICATION_SERVER in src/app/env.ts, the existing email card + email/emailAddress/emailFrequency settings fields on this branch.
  • LAYER the schedule feature on top of it: extend SettingsValues in src/app/settings.ts with emailHour/emailMinute/emailDayOfWeek/emailTimezone (persisted via the existing AppData settings sync), add the HH:MM time input (both frequencies) + day-of-week picker (weekly only) to the existing email card in src/routes/settings/alerts/+page.svelte, and extend the Mail adapter PUT payload with hour/minute/dayOfWeek/timezone.
  • DROP the dev-based duplicates: src/app/mail.ts (single file), the .env VITE_MAILSHIP_URL addition and any second email card / second adapter.

PUT /subscription/email contract (mailship, merged PR #28): {email, frequency, hour, minute, dayOfWeek, timezone}.

Verify pnpm check passes before pushing.

@fragua resolve_conflicts guidance (PR retargeted: dev → email-notifications): This branch was built against dev and duplicates the email-notifications feature. Resolution intent when integrating: - KEEP the email-notifications implementation: `src/app/mail/index.ts` (Mail adapter), `VITE_EMAIL_NOTIFICATION_SERVER` in `src/app/env.ts`, the existing email card + `email`/`emailAddress`/`emailFrequency` settings fields on this branch. - LAYER the schedule feature on top of it: extend `SettingsValues` in `src/app/settings.ts` with `emailHour`/`emailMinute`/`emailDayOfWeek`/`emailTimezone` (persisted via the existing AppData settings sync), add the HH:MM time input (both frequencies) + day-of-week picker (weekly only) to the existing email card in `src/routes/settings/alerts/+page.svelte`, and extend the Mail adapter PUT payload with `hour`/`minute`/`dayOfWeek`/`timezone`. - DROP the dev-based duplicates: `src/app/mail.ts` (single file), the `.env` `VITE_MAILSHIP_URL` addition and any second email card / second adapter. PUT /subscription/email contract (mailship, merged PR #28): `{email, frequency, hour, minute, dayOfWeek, timezone}`. Verify `pnpm check` passes before pushing.
hudson force-pushed flotilla-fc1-email-digests-let-users-choose-delivery--f63 from 5c4e07bb8d to f9878fdff1 2026-09-23 18:10:28 +00:00 Compare
Author
Collaborator

Conflicts resolved — branch rebuilt on top of email-notifications (was dev-based) and force-pushed.

Resolution: kept the email-notifications implementation (src/app/mail/index.ts adapter, VITE_EMAIL_NOTIFICATION_SERVER, the existing gated email card with NIP-98 register/enable flow + communities warning) and layered the schedule feature onto it: emailHour/emailMinute/emailDayOfWeek/emailTimezone in SettingsValues (defaults 17:00, device TZ), HH:MM time input + weekly day-of-week picker in the card, weekly select defaults day to Monday, PUT payload extended to {email, frequency, hour, minute, dayOfWeek, timezone} (mailship PR #28 contract). Dropped the dev-based dups: src/app/mail.ts, VITE_MAILSHIP_URL. Verified: svelte-check 0 errors, eslint clean, prettier clean.

Conflicts resolved — branch rebuilt on top of email-notifications (was dev-based) and force-pushed. Resolution: kept the email-notifications implementation (`src/app/mail/index.ts` adapter, `VITE_EMAIL_NOTIFICATION_SERVER`, the existing gated email card with NIP-98 register/enable flow + communities warning) and layered the schedule feature onto it: `emailHour`/`emailMinute`/`emailDayOfWeek`/`emailTimezone` in `SettingsValues` (defaults 17:00, device TZ), HH:MM time input + weekly day-of-week picker in the card, weekly select defaults day to Monday, PUT payload extended to `{email, frequency, hour, minute, dayOfWeek, timezone}` (mailship PR #28 contract). Dropped the dev-based dups: `src/app/mail.ts`, `VITE_MAILSHIP_URL`. Verified: svelte-check 0 errors, eslint clean, prettier clean.
matt approved these changes 2026-09-23 20:37:12 +00:00
matt merged commit 3df670c9f8 into email-notifications 2026-09-23 20:37:16 +00:00
matt deleted branch flotilla-fc1-email-digests-let-users-choose-delivery--f63 2026-09-23 20:37:21 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: matt/flotilla#5
No description provided.