Skip to content

Make email preference defaults and mandatory overrides consistent across onboarding and updates #140

Description

@grantfox-oss

Context

The email preference service in src/services/email-preference.service.ts has a clear preference model, but the default handling and mandatory overrides are split across multiple code paths. This can lead to inconsistent preferences for newly created users and for updates that modify only part of the preference payload.

Problem statement

Standardize how default preferences are created, merged, and enforced so that onboarding and later updates behave consistently and mandatory security notifications always remain deliverable.

Current behavior

  • src/services/email-preference.service.ts builds default preferences in one place, but the merge logic for updates and the mandatory override behavior are partially embedded in the service methods.
  • New users and existing users can hit slightly different code paths depending on whether preferences exist yet.

Required behavior

  • Default preferences should be created and merged in a single, predictable way.
  • Mandatory notification types should always bypass user preference opt-outs.
  • Preference updates should preserve the expected defaults while honoring explicit user changes.

Constraints

  • The change should preserve the current notification categories and API responses.
  • Existing preference records should remain valid after the change.

Acceptance criteria

  • Newly created users receive the expected default preference set.
  • Mandatory notification types are still delivered even when the user disables related categories.
  • Updating preferences merges correctly without dropping default categories.
  • Unit tests cover defaults, overrides, and update merges.

Out of scope

  • Reworking the notification taxonomy or introducing a new preferences UI.
  • Changing the email delivery infrastructure.

Hints and references

  • Review the shared EmailPreferenceCategories shape and the shouldSendEmail logic for the current precedence rules.

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions