Fix double counting users in presence channel
This commit is contained in:
parent
1380f0ba0a
commit
9da68ecd40
|
|
@ -63,9 +63,9 @@ class PresenceChannel extends Channel
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'presence' => [
|
'presence' => [
|
||||||
'ids' => $this->getUserIds(),
|
'ids' => $userIds = $this->getUserIds(),
|
||||||
'hash' => $this->getHash(),
|
'hash' => $this->getHash(),
|
||||||
'count' => count($this->users),
|
'count' => count($userIds),
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
@ -73,7 +73,7 @@ class PresenceChannel extends Channel
|
||||||
public function toArray(): array
|
public function toArray(): array
|
||||||
{
|
{
|
||||||
return array_merge(parent::toArray(), [
|
return array_merge(parent::toArray(), [
|
||||||
'user_count' => count($this->users),
|
'user_count' => count($this->getUserIds()),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -83,7 +83,7 @@ class PresenceChannel extends Channel
|
||||||
return (string) $channelData->user_id;
|
return (string) $channelData->user_id;
|
||||||
}, $this->users);
|
}, $this->users);
|
||||||
|
|
||||||
return array_values($userIds);
|
return array_values(array_unique($userIds));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue