Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: videoconf ringer not working after a temporary disconnection #35422

Open
wants to merge 1 commit into
base: release-7.4.1
Choose a base branch
from
Open
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/angry-colts-worry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

fixes an issue where videoconf calls could sometimes fail to ring an user after a temporary disconnection
21 changes: 12 additions & 9 deletions apps/meteor/client/lib/VideoConfManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,17 +305,16 @@ export const VideoConfManager = new (class VideoConfManager extends Emitter<Vide
public updateUser(): void {
const userId = Meteor.userId();

if (this.userId === userId) {
this.debugLog(`[VideoConf] Logged user has not changed, so we're not changing the hooks.`);
return;
}

this.debugLog(`[VideoConf] Logged user has changed.`);
this.debugLog(`[VideoConf] Logged user or connection status has changed.`);

if (this.userId) {
this.disconnect();
this.disconnect(this.userId !== userId);
}

if (!Meteor.status().connected || (userId && Meteor.loggingIn())) {
this.debugLog(`[VideoConf] Connection lost or login process still pending, skipping user change.`);
return;
}
if (userId) {
this.connectUser(userId);
}
Expand Down Expand Up @@ -458,12 +457,17 @@ export const VideoConfManager = new (class VideoConfManager extends Emitter<Vide
sdk.rest.post('/v1/video-conference.cancel', { callId });
}

private disconnect(): void {
private disconnect(clearCalls = true): void {
console.log(`[VideoConf] disconnecting user ${this.userId}`);
for (const hook of this.hooks) {
hook();
}
this.hooks = [];
this.userId = undefined;

if (!clearCalls) {
return;
}

if (this.currentCallHandler) {
clearInterval(this.currentCallHandler);
Expand All @@ -478,7 +482,6 @@ export const VideoConfManager = new (class VideoConfManager extends Emitter<Vide
clearTimeout(call.acceptTimeout);
}
});
this.userId = undefined;
this.incomingDirectCalls.clear();
this.dismissedCalls.clear();
this.currentCallData = undefined;
Expand Down
Loading