Use a set to avoid message duplication

This commit is contained in:
Jake Barnby 2024-02-28 01:01:39 +13:00
parent 7a8ea7278e
commit f3fa172482
No known key found for this signature in database
GPG key ID: C437A8CC85B96E9C

View file

@ -189,7 +189,7 @@ class Messaging extends Action
}
/**
* @var array<string, array<string>> $identifiers
* @var array<string, array<string, null>> $identifiers
*/
$identifiers = [];
@ -211,7 +211,8 @@ class Messaging extends Action
if (!\array_key_exists($providerId, $identifiers)) {
$identifiers[$providerId] = [];
}
$identifiers[$providerId][] = $recipient->getAttribute('identifier');
// Use null as value to avoid duplicate keys
$identifiers[$providerId][$target->getAttribute('identifier')] = null;
}
}