When a user's subscription tier changes (via admin override, user upgrade/downgrade, or grace period auto-downgrade), they should receive both an email notification and an in-app notification.
Email notification sent when tier changes with details:
Previous tier
New tier
Reason (admin override, user action, grace period expiration)
In-app notification displayed in notification bell with same details
Implementation Notes
The notification infrastructure already exists (backend/src/features/notifications/). This requires:
Extend TemplateKey type to include 'subscription_tier_change'
Create migration for new email template
Add sendTierChangeNotification() to NotificationsService
Create in-app notification on tier change
Integrate into:
SubscriptionsService.adminOverrideTier()
SubscriptionsService.upgradeSubscription()
SubscriptionsService.downgradeSubscription()
grace-period.job.ts
Acceptance Criteria
Email notification sent when tier changes (admin, user action, or auto-downgrade)
In-app notification displayed when tier changes
Mobile + desktop responsive validation
## Summary
When a user's subscription tier changes (via admin override, user upgrade/downgrade, or grace period auto-downgrade), they should receive both an email notification and an in-app notification.
## Related
- Deferred from #58
## Current Behavior
Tier changes occur without notifying the user.
## Expected Behavior
1. Email notification sent when tier changes with details:
- Previous tier
- New tier
- Reason (admin override, user action, grace period expiration)
2. In-app notification displayed in notification bell with same details
## Implementation Notes
The notification infrastructure already exists (`backend/src/features/notifications/`). This requires:
1. Extend `TemplateKey` type to include `'subscription_tier_change'`
2. Create migration for new email template
3. Add `sendTierChangeNotification()` to NotificationsService
4. Create in-app notification on tier change
5. Integrate into:
- `SubscriptionsService.adminOverrideTier()`
- `SubscriptionsService.upgradeSubscription()`
- `SubscriptionsService.downgradeSubscription()`
- `grace-period.job.ts`
## Acceptance Criteria
- [ ] Email notification sent when tier changes (admin, user action, or auto-downgrade)
- [ ] In-app notification displayed when tier changes
- [ ] Mobile + desktop responsive validation
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
When a user's subscription tier changes (via admin override, user upgrade/downgrade, or grace period auto-downgrade), they should receive both an email notification and an in-app notification.
Related
Current Behavior
Tier changes occur without notifying the user.
Expected Behavior
Email notification sent when tier changes with details:
In-app notification displayed in notification bell with same details
Implementation Notes
The notification infrastructure already exists (
backend/src/features/notifications/). This requires:TemplateKeytype to include'subscription_tier_change'sendTierChangeNotification()to NotificationsServiceSubscriptionsService.adminOverrideTier()SubscriptionsService.upgradeSubscription()SubscriptionsService.downgradeSubscription()grace-period.job.tsAcceptance Criteria
Milestone: Implementation Complete
Phase: Execution | Agent: Developer | Status: PASS
Completed Tasks
Extended TemplateKey type - Added
'subscription_tier_change'to the TemplateKey union type and Zod schema innotifications.types.tsCreated migration for email template - Added
007_subscription_tier_change_template.sqlwith:Added sendTierChangeNotification() to NotificationsService - New method that:
Integrated into SubscriptionsService - Added notification calls to:
upgradeSubscription()- reason:user_upgradedowngradeSubscription()- reason:user_downgradeadminOverrideTier()- reason:admin_overrideIntegrated into grace-period.job.ts - Sends notification on auto-downgrade:
grace_period_expirationVerification
Files Changed
backend/src/features/notifications/domain/notifications.types.tsbackend/src/features/notifications/domain/notifications.service.tsbackend/src/features/notifications/migrations/007_subscription_tier_change_template.sqlbackend/src/features/subscriptions/domain/subscriptions.service.tsbackend/src/features/subscriptions/jobs/grace-period.job.tsVerdict: PASS | Next: Open PR for review