-
Notifications
You must be signed in to change notification settings - Fork 30
Feat: Weekly email digest of followed content #141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Feat: Weekly email digest of followed content #141
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements an automated weekly email digest system that sends users a summary of platform activity every Friday at 09:00 UTC. Users can opt-in or opt-out of receiving these digests through their profile settings.
Changes:
- Added database fields to track user digest preferences and last send timestamp
- Created a digest service to aggregate weekly content (reports, vulnerabilities, forum threads) and generate HTML emails
- Implemented a background hosted service for scheduling and executing the weekly digest job
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| UserProfileModel.cs | Added ReceiveWeeklyDigest and LastDigestSentAt fields to track user preferences and prevent duplicate sends |
| DigestService.cs | Implements content aggregation logic and HTML email generation for weekly digests |
| DigestHostedService.cs | Background service that schedules and triggers digest processing every Friday at 09:00 UTC |
| IEmailService.cs | Email service abstraction with console-based implementation for development |
| Startup.cs | Registers new services and background worker in dependency injection container |
| 20260205100000_AddWeeklyDigestFields.cs | Database migration to add digest-related columns to user_profiles table |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Backend/SorobanSecurityPortalApi/Services/ProcessingServices/DigestHostedService.cs
Outdated
Show resolved
Hide resolved
Backend/SorobanSecurityPortalApi/Services/ProcessingServices/DigestHostedService.cs
Outdated
Show resolved
Hide resolved
Backend/SorobanSecurityPortalApi/Services/ProcessingServices/DigestService.cs
Outdated
Show resolved
Hide resolved
Backend/SorobanSecurityPortalApi/Services/ProcessingServices/DigestService.cs
Outdated
Show resolved
Hide resolved
Backend/SorobanSecurityPortalApi/Services/ProcessingServices/DigestService.cs
Outdated
Show resolved
Hide resolved
|
@0xGeorgii this is updated as well |
Yeah but the model needs to be updated to be able to track subscription for personalized feeds. Should I do that? |
|
yes, please, better to update existing models if they are semantically fit with new functionality than introduce new models |
@0xGeorgii I didn't introduce any new model though, I only updated the UserProfileModel to allow to opt in for the feeds |
|
@Bosun-Josh121, yes, I see, but it seems the subscription model is more suitable for this feature. Do you agree? |
Yes it is. I'll update it shortly |
|
@0xGeorgii updated |
Feat: Personalized Weekly Email Digest & Subscription System
Closes #101
Summary
This PR implements a robust Weekly Email Digest system. It introduces a background worker that runs on a configurable weekly schedule (default: Friday at 09:00 UTC) to aggregate new activity, Audit Reports, Vulnerabilities and Forum Thread, then sends personalized email summaries to users.
The system is designed to be "spam-free," sending emails only when relevant content exists for the entities a user explicitly follows.
Changes
1. Database & Models
SubscriptionModel:ProtocolIdandCategoryIdForeign Keys to support specific content filtering.UserIdForeign Key linked to theLogintable (mapped toLoginId).Emailto be nullable to support registered users viaUserIdwhile keeping guest support possible.UserProfileModel:ReceiveWeeklyDigest(bool, defaulttrue) for opt-out management.LastDigestSentAt(DateTime) to track send history and prevent duplicate emails.2. Core Services
DigestService(New Business Logic):LastDigestSentAt.FrontendUrl.DigestHostedService(Background Worker):IHostedServiceto run indefinitely.IEmailService: Introduced interface for email abstraction (withConsoleEmailServiceimplementation for dev/logging).3. Dependency Injection (
Startup.cs)ConfigureServices:services.AddSingleton<IEmailService, ConsoleEmailService>();services.AddScoped<IDigestService, DigestService>();services.AddHostedService<DigestHostedService>();4. Configuration (
appsettings.json)5. Testing
DigestServiceTests: Added a comprehensive test suite covering 6 scenarios:LastDigestSentAtprevents double-sending.ReceiveWeeklyDigest = falseis respected.