fix(messaging): remove redundant user fetch

This commit is contained in:
Jake Barnby
2026-05-11 19:51:26 +12:00
parent c6f91e18c4
commit 5c09d726ba
+4 -8
View File
@@ -162,17 +162,13 @@ class Messaging extends Action
}
if (\count($userIds) > 0) {
$users = $dbForProject->find('users', [
Query::equal('$id', $userIds),
$targets = $dbForProject->find('targets', [
Query::equal('userId', $userIds),
Query::equal('providerType', [$providerType]),
Query::limit(\count($userIds)),
]);
foreach ($users as $user) {
$targets = \array_filter($user->getAttribute('targets'), function (Document $target) use ($providerType) {
return $target->getAttribute('providerType') === $providerType;
});
\array_push($allTargets, ...$targets);
}
\array_push($allTargets, ...$targets);
}
if (\count($targetIds) > 0) {