Skip to content

Commit

Permalink
Merge pull request #16 from ably-forks/fix/presence-here
Browse files Browse the repository at this point in the history
Fixed presence here method callback data set
  • Loading branch information
sacOO7 authored Nov 28, 2022
2 parents dc323ec + 638e469 commit cbe33f5
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
1 change: 1 addition & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
push:
branches:
- master
- '*.x'
schedule:
- cron: '0 0 * * 0' # Once in a week run tests to check assertions against updated(if any) ably-js package.

Expand Down
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Release Notes

## [Unreleased](https://github.com/laravel/echo/compare/v1.14.1...master)
## [Unreleased](https://github.com/laravel/echo/compare/v1.14.2...master)

## [v1.14.2](https://github.com/laravel/echo/compare/v1.14.1...v1.14.2) - 2022-11-22

### Fixed

- Fix node type issue by @timacdonald in https://github.com/laravel/echo/pull/361

## [v1.14.1](https://github.com/laravel/echo/compare/v1.14.0...v1.14.1) - 2022-10-25

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"@babel/preset-env": "^7.16.11",
"@rollup/plugin-babel": "^5.3.1",
"@types/jest": "^27.4.1",
"@types/node": "^17.0.21",
"@types/node": "^18.11.9",
"@typescript-eslint/eslint-plugin": "^5.14.0",
"@typescript-eslint/parser": "^5.14.0",
"ably": "^1.2.20",
Expand Down
4 changes: 2 additions & 2 deletions src/channel/ably-presence-channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ export class AblyPresenceChannel extends AblyChannel implements PresenceChannel
*/
here(callback: Function): AblyPresenceChannel {
this.channel.presence.subscribe(['enter', 'update', 'leave'], () =>
this.channel.presence.get(
(err, members) => callback(members, err) // returns local sync copy of updated members
this.channel.presence.get((err, members) =>
callback(members.map(({data}) => data), err)
)
);
return this;
Expand Down
5 changes: 3 additions & 2 deletions tests/ably/ably-presence-channel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ describe('AblyPresenceChannel', () => {
() => {
expect(err).toBeFalsy();
expect(members).toHaveLength(1);
expect(members[0].clientId).toBe('sacOO7@github.com');
expect(members[0].data).toStrictEqual({ id: 'sacOO7@github.com', name: 'sacOO7' });
expect(members[0].id).toBe('sacOO7@github.com');
expect(members[0].name).toBe('sacOO7');
expect(members[0]).toStrictEqual({ id: 'sacOO7@github.com', name: 'sacOO7' });
},
done,
true
Expand Down

0 comments on commit cbe33f5

Please sign in to comment.