Skip to content

Commit

Permalink
Merge pull request #1827 from nextcloud/backport/1824/stable16
Browse files Browse the repository at this point in the history
[stable16] Fix status not kept after forced reconnections
  • Loading branch information
nickvergessen authored May 16, 2019
2 parents 68392dd + ccc6c91 commit 81f7d89
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
16 changes: 16 additions & 0 deletions js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,16 @@
}.bind(this));

this.signaling.on('joinCall', function() {
// Do not perform the initial adjustments when joining a call
// again due to a forced reconnection.
if (this._reconnectCallToken === this.activeRoom.get('token')) {
delete this._reconnectCallToken;

return;
}

delete this._reconnectCallToken;

// Disable video when joining a call in a room with more than 5
// participants.
var participants = this.activeRoom.get('participants');
Expand All @@ -632,6 +642,12 @@
}
}.bind(this));

this.signaling.on('leaveCall', function (token, reconnect) {
if (reconnect) {
this._reconnectCallToken = token;
}
}.bind(this));

$(window).unload(function () {
this.connection.leaveCurrentRoom();
this.signaling.disconnect();
Expand Down
16 changes: 16 additions & 0 deletions js/embedded.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,16 @@
}.bind(this));

this.signaling.on('joinCall', function() {
// Do not perform the initial adjustments when joining a call
// again due to a forced reconnection.
if (this._reconnectCallToken === this.activeRoom.get('token')) {
delete this._reconnectCallToken;

return;
}

delete this._reconnectCallToken;

// Disable video when joining a call in a room with more than 5
// participants.
var participants = this.activeRoom.get('participants');
Expand All @@ -152,6 +162,12 @@
}
}.bind(this));

this.signaling.on('leaveCall', function (token, reconnect) {
if (reconnect) {
this._reconnectCallToken = token;
}
}.bind(this));

$(window).unload(function () {
this.connection.leaveCurrentRoom();
this.signaling.disconnect();
Expand Down
8 changes: 7 additions & 1 deletion js/signaling.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
this.sessionId = '';
this.currentRoomToken = null;
this.currentCallToken = null;
this.currentCallFlags = null;
this.handlers = {};
this.features = {};
this.pendingChatRequests = [];
Expand Down Expand Up @@ -136,6 +137,7 @@
OCA.Talk.Signaling.Base.prototype.disconnect = function() {
this.sessionId = '';
this.currentCallToken = null;
this.currentCallFlags = null;
};

OCA.Talk.Signaling.Base.prototype.hasFeature = function(feature) {
Expand Down Expand Up @@ -173,6 +175,7 @@
if (this.currentCallToken) {
this.leaveCall(this.currentCallToken);
this.currentCallToken = null;
this.currentCallFlags = null;
}
};

Expand Down Expand Up @@ -232,9 +235,10 @@
this._runPendingChatRequests();
if (this.currentCallToken === token) {
// We were in this call before, join again.
this.joinCall(token);
this.joinCall(token, this.currentCallFlags);
} else {
this.currentCallToken = null;
this.currentCallFlags = null;
}
this._joinRoomSuccess(token, result.ocs.data.sessionId);
}.bind(this),
Expand Down Expand Up @@ -311,6 +315,7 @@
},
success: function () {
this.currentCallToken = token;
this.currentCallFlags = flags;
this._trigger('joinCall', [token]);
this._joinCallSuccess(token);
}.bind(this),
Expand Down Expand Up @@ -341,6 +346,7 @@
// We left the current call.
if (!keepToken && token === this.currentCallToken) {
this.currentCallToken = null;
this.currentCallFlags = null;
}
}.bind(this)
});
Expand Down

0 comments on commit 81f7d89

Please sign in to comment.