mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
chore: refactor adapter
This commit is contained in:
@@ -82,33 +82,21 @@ class Realtime extends Event
|
||||
bucket: $bucket,
|
||||
);
|
||||
|
||||
if (!empty($this->getTargets())) {
|
||||
foreach ($this->getTargets() as $targetProjectId) {
|
||||
RealtimeAdapter::send(
|
||||
projectId: $targetProjectId,
|
||||
payload: $this->getRealtimePayload(),
|
||||
events: $allEvents,
|
||||
channels: $target['channels'],
|
||||
roles: $target['roles'],
|
||||
options: [
|
||||
'permissionsChanged' => $target['permissionsChanged'],
|
||||
'userId' => $this->getParam('userId')
|
||||
]
|
||||
);
|
||||
}
|
||||
} else {
|
||||
RealtimeAdapter::send(
|
||||
projectId: $target['projectId'] ?? $this->getProject()->getId(),
|
||||
payload: $this->getRealtimePayload(),
|
||||
events: $allEvents,
|
||||
channels: $target['channels'],
|
||||
roles: $target['roles'],
|
||||
options: [
|
||||
'permissionsChanged' => $target['permissionsChanged'],
|
||||
'userId' => $this->getParam('userId')
|
||||
]
|
||||
);
|
||||
}
|
||||
$projectIds = !empty($this->getTargets())
|
||||
? $this->getTargets()
|
||||
: [$target['projectId'] ?? $this->getProject()->getId()];
|
||||
|
||||
RealtimeAdapter::send(
|
||||
projectId: $projectIds,
|
||||
payload: $this->getRealtimePayload(),
|
||||
events: $allEvents,
|
||||
channels: $target['channels'],
|
||||
roles: $target['roles'],
|
||||
options: [
|
||||
'permissionsChanged' => $target['permissionsChanged'],
|
||||
'userId' => $this->getParam('userId')
|
||||
]
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user