Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/bump-patch-1709669273957.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

Bump @rocket.chat/meteor version.
5 changes: 5 additions & 0 deletions .changeset/wicked-months-laugh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

Fix users presence stuck as online after connecting using mobile apps
9 changes: 8 additions & 1 deletion apps/meteor/ee/server/startup/presence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,16 @@ Meteor.startup(() => {
});

Accounts.onLogin((login: any): void => {
if (login.type !== 'resume') {
if (login.type !== 'resume' || !login.connection.id) {
return;
}

// validate if it is a real WS connection and is still open
const session = Meteor.server.sessions.get(login.connection.id);
if (!session) {
return;
}

void (async function () {
await Presence.newConnection(login.user._id, login.connection.id, nodeId);
updateConns();
Expand Down
35 changes: 35 additions & 0 deletions apps/meteor/tests/end-to-end/api/01-users.js
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,41 @@ describe('[Users]', function () {
})
.end(done);
});

describe('Logging in with type: "resume"', () => {
let user;
let userCredentials;

before(async () => {
user = await createUser({ joinDefaultChannels: false });
userCredentials = await login(user.username, password);
});

after(async () => deleteUser(user));

it('should return "offline" after a login type "resume" via REST', async () => {
await request
.post(api('login'))
.send({
resume: userCredentials['X-Auth-Token'],
})
.expect('Content-Type', 'application/json')
.expect(200);

await request
.get(api('users.getPresence'))
.set(credentials)
.query({
userId: user._id,
})
.expect('Content-Type', 'application/json')
.expect(200)
.expect((res) => {
expect(res.body).to.have.property('success', true);
expect(res.body).to.have.nested.property('presence', 'offline');
});
});
});
});

describe('[/users.presence]', () => {
Expand Down
16 changes: 8 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9348,9 +9348,9 @@ __metadata:
"@rocket.chat/icons": "*"
"@rocket.chat/prettier-config": "*"
"@rocket.chat/styled": "*"
"@rocket.chat/ui-contexts": 4.0.1
"@rocket.chat/ui-contexts": 4.0.2
"@rocket.chat/ui-kit": 0.33.0
"@rocket.chat/ui-video-conf": 4.0.1
"@rocket.chat/ui-video-conf": 4.0.2
"@tanstack/react-query": "*"
react: "*"
react-dom: "*"
Expand Down Expand Up @@ -9432,14 +9432,14 @@ __metadata:
ts-jest: ~29.1.1
typescript: ~5.3.2
peerDependencies:
"@rocket.chat/core-typings": 6.6.1
"@rocket.chat/core-typings": 6.6.2
"@rocket.chat/css-in-js": "*"
"@rocket.chat/fuselage": "*"
"@rocket.chat/fuselage-tokens": "*"
"@rocket.chat/message-parser": "*"
"@rocket.chat/styled": "*"
"@rocket.chat/ui-client": 4.0.1
"@rocket.chat/ui-contexts": 4.0.1
"@rocket.chat/ui-client": 4.0.2
"@rocket.chat/ui-contexts": 4.0.2
katex: "*"
react: "*"
languageName: unknown
Expand Down Expand Up @@ -10621,7 +10621,7 @@ __metadata:
"@rocket.chat/fuselage": "*"
"@rocket.chat/fuselage-hooks": "*"
"@rocket.chat/icons": "*"
"@rocket.chat/ui-contexts": 4.0.1
"@rocket.chat/ui-contexts": 4.0.2
react: ~17.0.2
languageName: unknown
linkType: soft
Expand Down Expand Up @@ -10796,7 +10796,7 @@ __metadata:
"@rocket.chat/fuselage-hooks": "*"
"@rocket.chat/icons": "*"
"@rocket.chat/styled": "*"
"@rocket.chat/ui-contexts": 4.0.1
"@rocket.chat/ui-contexts": 4.0.2
react: ^17.0.2
react-dom: ^17.0.2
languageName: unknown
Expand Down Expand Up @@ -10885,7 +10885,7 @@ __metadata:
peerDependencies:
"@rocket.chat/layout": "*"
"@rocket.chat/tools": 0.2.1
"@rocket.chat/ui-contexts": 4.0.1
"@rocket.chat/ui-contexts": 4.0.2
"@tanstack/react-query": "*"
react: "*"
react-hook-form: "*"
Expand Down