Skip notifications for inactive users

Signed-off-by: Sacha Al Himdani <sacha@probo.com>
This commit is contained in:
Sacha Al Himdani
2026-06-19 08:40:02 +02:00
parent fd2e0903ee
commit fdf5188707
2 changed files with 16 additions and 0 deletions

View File

@@ -437,6 +437,13 @@ WITH next_group AS (
AND doc.deleted_at IS NULL
AND doc.archived_at IS NULL
)
AND EXISTS (
SELECT 1
FROM iam_membership_profiles p
WHERE p.id = document_version_approval_decisions.approver_id
AND p.state = @recipient_state::membership_state
AND (p.contract_end_date IS NULL OR p.contract_end_date >= @now::date)
)
GROUP BY
organization_id,
approver_id
@@ -479,6 +486,7 @@ ORDER BY
args := pgx.StrictNamedArgs{
"state": DocumentVersionApprovalDecisionStatePending,
"recipient_state": ProfileStateActive,
"max_notifications": documentNotificationMaxCount,
"now": now,
"debounce_before": debounceBefore,

View File

@@ -461,6 +461,13 @@ WITH next_group AS (
AND doc.deleted_at IS NULL
AND doc.archived_at IS NULL
)
AND EXISTS (
SELECT 1
FROM iam_membership_profiles p
WHERE p.id = document_version_signatures.signed_by_profile_id
AND p.state = @recipient_state::membership_state
AND (p.contract_end_date IS NULL OR p.contract_end_date >= @now::date)
)
GROUP BY
organization_id,
signed_by_profile_id
@@ -502,6 +509,7 @@ ORDER BY
args := pgx.StrictNamedArgs{
"state": DocumentVersionSignatureStateRequested,
"recipient_state": ProfileStateActive,
"max_notifications": documentNotificationMaxCount,
"now": now,
"debounce_before": debounceBefore,