mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-09 13:01:00 +00:00
fix: reject partial notification attribution
- retain only complete delivery principal pairs\n- preserve legacy self-delivery records
This commit is contained in:
1 parent
8b275c87db
commit
ce94f4773f
1 file changed
+23
-2
@@ -67,9 +67,30 @@ export function recordPushAttemptForPayload(
|
||||
legacyUserId: string,
|
||||
record: PushAttemptRecordBase & { userId?: string },
|
||||
): void {
|
||||
const hasRecordUserId = payload.recordUserId !== undefined;
|
||||
const hasRecipientUserId = payload.recipientUserId !== undefined;
|
||||
|
||||
if (hasRecordUserId !== hasRecipientUserId) {
|
||||
getEvent()?.addWarning(
|
||||
"push_attempt_ledger_write_failed invalid_attribution",
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!hasRecordUserId) {
|
||||
recordPushAttempt({
|
||||
userId: legacyUserId,
|
||||
channel: record.channel,
|
||||
eventType: record.eventType,
|
||||
result: record.result,
|
||||
reason: record.reason,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
recordPushAttempt({
|
||||
recordUserId: payload.recordUserId ?? legacyUserId,
|
||||
recipientUserId: payload.recipientUserId ?? legacyUserId,
|
||||
recordUserId: payload.recordUserId!,
|
||||
recipientUserId: payload.recipientUserId!,
|
||||
channel: record.channel,
|
||||
eventType: record.eventType,
|
||||
result: record.result,
|
||||
|
||||
Reference in new issue
Block a user