[dev] [Marfuen] mariano/fix-policy-digest-false-positives#2594
Merged
Conversation
The helper compared policy.signedBy[] against member.user.id, but signedBy stores member ids (written by the portal accept action and read by every other consumer). Users who had signed their policies were still receiving daily digest emails — the comparison never matched. Switched to member.id with an inline regression test covering the reported owner+employee case. Also roll up pending policies across orgs by user.id so a person with memberships in multiple orgs receives one email with per-org sections instead of one email per org. Per-org unsubscribe is still honored: a user opted out of policy notifications in org A only drops that org from the rollup and still gets an email about org B. Finally, match weekly-task-reminder's dead-org filter at the DB query — hasAccess, onboardingCompleted, and at least one non-deactivated member with a session updated in the last 90 days — so we stop sending to abandoned orgs. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
DTS build failed because noUncheckedIndexedAccess types array[0] as possibly undefined, even right after a length check. Destructure and narrow with a truthy guard so strict TS accepts the template and the shared subject helper. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
|
🎉 This PR is included in version 3.23.6 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is an automated pull request to merge mariano/fix-policy-digest-false-positives into dev.
It was created by the [Auto Pull Request] action.
Summary by cubic
Fixes false‑positive policy digest emails and rolls up pending policies into one email per user across orgs, while skipping inactive orgs and honoring per‑org unsubscribes.
Bug Fixes
policy.signedBytomember.id(notmember.user.id) to avoid false positives; adds regression tests including multi‑role members.@trycompai/emaildigest template and subject helper fornoUncheckedIndexedAccessto fix DTS builds.New Features
computePolicyAcknowledgmentDigestSubjectin@trycompai/email; update the digest template for multi‑org sections and per‑org buttons.hasAccess,onboardingCompleted, and a session in the last 90 days).recipients; renameemailsSkippedUnsubscribedtoorgsSkippedUnsubscribed.Written for commit c50eccf. Summary will update on new commits.