Fixed uniqueness
This commit is contained in:
parent
b7ba98a6a6
commit
16ff2aa2b6
|
|
@ -323,7 +323,7 @@ class LocalChannelManager implements ChannelManager
|
|||
|
||||
$members = collect($members)->map(function ($user) {
|
||||
return json_decode($user);
|
||||
})->unique('id')->toArray();
|
||||
})->unique('user_id')->toArray();
|
||||
|
||||
return new FulfilledPromise($members);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -350,7 +350,7 @@ class RedisChannelManager extends LocalChannelManager
|
|||
->map(function ($user) {
|
||||
return json_decode($user);
|
||||
})
|
||||
->unique('id')
|
||||
->unique('user_id')
|
||||
->toArray();
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,6 +73,41 @@ class PresenceChannelTest extends TestCase
|
|||
]);
|
||||
}
|
||||
|
||||
$rick->assertSentEvent('pusher_internal:subscription_succeeded', [
|
||||
'channel' => 'presence-channel',
|
||||
'data' => json_encode([
|
||||
'presence' => [
|
||||
'ids' => ['1'],
|
||||
'hash' => ['1' => []],
|
||||
'count' => 1,
|
||||
],
|
||||
]),
|
||||
]);
|
||||
|
||||
$morty->assertSentEvent('pusher_internal:subscription_succeeded', [
|
||||
'channel' => 'presence-channel',
|
||||
'data' => json_encode([
|
||||
'presence' => [
|
||||
'ids' => ['1', '2'],
|
||||
'hash' => ['1' => [], '2' => []],
|
||||
'count' => 2,
|
||||
],
|
||||
]),
|
||||
]);
|
||||
|
||||
// The duplicated-user_id connection should get basically the list of ids
|
||||
// without dealing with duplicate user ids.
|
||||
$pickleRick->assertSentEvent('pusher_internal:subscription_succeeded', [
|
||||
'channel' => 'presence-channel',
|
||||
'data' => json_encode([
|
||||
'presence' => [
|
||||
'ids' => ['1', '2'],
|
||||
'hash' => ['1' => [], '2' => []],
|
||||
'count' => 2,
|
||||
],
|
||||
]),
|
||||
]);
|
||||
|
||||
$this->channelManager
|
||||
->getGlobalConnectionsCount('1234', 'presence-channel')
|
||||
->then(function ($total) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue