KamoCRM

Legal and training audiences reach team members only, by employment status

Fixkamo-shared-library
Shipped
November 13, 2026 at 3:53 AM UTC
Author
Kamo
Commit
3a83e65

TeamMemberRepo.findAudience filtered on employment status and record state but never on members.member_type. Every member, MEMBER-typed ones included, has a member_team_member row with a department, and JPQL `FROM TeamMember` does not filter on the discriminator, so legal packages sent to a department reached people who are not team members (five in Kamo's org, 2026-11-12). - findAudienceIds: native SQL with members.member_type = 'TEAM_MEMBER', is_active, and team_membership_status IN (:statuses). findAudience loads those ids; the 5-arg overload keeps ACTIVE only. - findActiveByIdsAnyMemberType: the old predicate (ACTIVE, any member type), for compliance requirements only — whoever withdraws commission still owes a W-9. - LegalPackage.audienceStatuses **************** VARCHAR(255) DEFAULT 'ACTIVE', applied by hand before this push): the employment statuses a package targets. Null, blank or unknown reads as ACTIVE.

All changes

Like what you see shipping?

All of it arrives in your workspace on its own. Start on the free plan and read this page again in a month.

Start Free ForeverView Pricing