Skip to content

Email services#2

Merged
mtherien merged 12 commits intomainfrom
EmailServices
Apr 8, 2026
Merged

Email services#2
mtherien merged 12 commits intomainfrom
EmailServices

Conversation

@mtherien
Copy link
Copy Markdown
Contributor

@mtherien mtherien commented Apr 8, 2026

No description provided.

mtherien added 12 commits April 6, 2026 23:05
Introduce Famick.HomeManagement.Messaging library that replaces scattered
inline email HTML and the evaluator/dispatcher notification pipeline with
a unified IMessageService backed by Mustache templates.

- Add MessageType enum (consolidates NotificationType + transactional types)
- Add Mustache templates for all 9 message types across 5 transport channels
- Add IMessageService with SendAsync (preference-routed) and SendTransactionalAsync
- Add transport abstractions: email, SMS, push, in-app
- Add CAN-SPAM/GDPR compliance footer auto-inserted on notification emails
- Add RFC 2369 List-Unsubscribe and RFC 8058 One-Click headers
- Split ExpiryLowStock into separate Expiry and LowStock evaluators
- Migrate transactional email call sites to IMessageService
- Refactor background services to use IMessageService instead of dispatchers
- Add MessagingStartup with AddMessaging() and ValidateMessagingTemplates()
- Add Famick.HomeManagement.Messaging.Tests.Unit (21 tests)
- Add EF migration for SmsEnabled, PhoneNumber, and ExpiryLowStock data split
Tracks cloud commit for unified messaging service migration
(PushMessageTransport, FeatureAnnouncementEvaluator, Messaging ref).
- Add MessageTypeExtensions with IsNotification()/IsTransactional()
- Replace all hardcoded (int)type threshold checks with extension methods
- Reject transactional message types in preference update validator
- Add defense-in-depth filter in NotificationService.UpdatePreferencesAsync
- Add Push and SMS toggle columns to NotificationPreferencesEditor UI
…minder

Add content hash-based change detection to the notification background
service. Daily notifications are skipped when the underlying data hasn't
changed since the last notification. Saturday always sends as a weekly
reminder regardless of changes.

- Add ContentHash column to Notification entity
- Add ContentHasher utility (SHA256 of serialized IMessageData)
- Add GetLastContentHashAsync to INotificationService
- Compare hashes in NotificationBackgroundService before dispatching
- Pass content hash through RenderedMessage to InAppMessageTransport
Move notification preferences from Settings to the Profile page in both
web and mobile apps so users manage them alongside their personal info.

Web:
- Move NotificationPreferencesEditor from Settings.razor to Profile.razor

Mobile:
- Add Notifications tab to Profile flyout in AppShell
- Settings page redirects to Profile > Notifications tab
- Add SmsEnabled to mobile NotificationPreferenceItemDto
- Add tab_notifications.svg icon
Wrap the MudMenu activator content in a MudButton with explicit
context.ToggleAsync handler. MudBlazor 9.x no longer auto-opens
menus from ActivatorContent clicks — requires explicit wiring.
Also rename context to menuContext to avoid collision with the
enclosing AuthorizeView context.
Add scripts/PreviewEmails console project that renders all 9 message
templates to HTML files with sample data for local review. Generates
both transactional and notification emails with compliance footers.

Usage: dotnet run --project scripts/PreviewEmails [MessageType]
Convert UTC start times to the tenant's configured time zone before
formatting in the CalendarEventEvaluator. Times now display as
"6:00 PM" instead of "18:00 UTC".
Add a blue (#1976D2) header bar to the email layout with the Famick
logo loaded from the app's static assets URL. Notification emails use
the hosted logo-dark.svg via BaseUrl; transactional emails fall back
to a styled text heading. Layout also updated with card-style wrapper,
rounded corners, and light background.
Add "View in App" buttons to notification emails (Expiry, LowStock,
TaskSummary, CalendarReminder) using BaseUrl + DeepLinkUrl for universal
links that open in the native app on mobile. Update email layout to
match website branding (Forest Green header, icon, Roboto font, dark
mode support). Add Compliance configuration section to appsettings.
@mtherien mtherien merged commit 4f906e4 into main Apr 8, 2026
1 check failed
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