Commit b992c23f authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

На ConnectionStateChanged проверяем был ли пользователь в списке.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@56732 954022d7-b5bf-4e40-9824-e11837661b57
parent a81b0e8e
...@@ -723,26 +723,31 @@ ...@@ -723,26 +723,31 @@
}; };
DocsCoApi.prototype._onConnectionStateChanged = function (data) { DocsCoApi.prototype._onConnectionStateChanged = function (data) {
var userStateChanged = null; var userStateChanged = null, userId, stateChanged = false;
if (undefined !== data["state"] && this.onConnectionStateChanged) { if (undefined !== data["state"] && this.onConnectionStateChanged) {
userStateChanged = new asc_user(data); userStateChanged = new asc_user(data);
userId = userStateChanged.asc_getId();
if (userStateChanged.asc_getState()) { if (userStateChanged.asc_getState()) {
this._participants[userStateChanged.asc_getId()] = userStateChanged; this._participants[userId] = userStateChanged;
++this._countEditUsers; ++this._countEditUsers;
} else { stateChanged = true;
delete this._participants[userStateChanged.asc_getId()]; } else if (this._participants.hasOwnProperty(userId)){
delete this._participants[userId];
--this._countEditUsers; --this._countEditUsers;
stateChanged = true;
} }
// Посылаем эвент о совместном редактировании if (stateChanged) {
if (1 < this._countEditUsers) // Посылаем эвент о совместном редактировании
this._onStartCoAuthoring(/*isStartEvent*/false); if (1 < this._countEditUsers)
else this._onStartCoAuthoring(/*isStartEvent*/false);
this._onEndCoAuthoring(/*isStartEvent*/false); else
this._onEndCoAuthoring(/*isStartEvent*/false);
this.onParticipantsChanged(this._participants, this._countEditUsers); this.onParticipantsChanged(this._participants, this._countEditUsers);
this.onConnectionStateChanged(userStateChanged); this.onConnectionStateChanged(userStateChanged);
}
} }
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment