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,18 +723,22 @@ ...@@ -723,18 +723,22 @@
}; };
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) if (1 < this._countEditUsers)
this._onStartCoAuthoring(/*isStartEvent*/false); this._onStartCoAuthoring(/*isStartEvent*/false);
...@@ -744,6 +748,7 @@ ...@@ -744,6 +748,7 @@
this.onParticipantsChanged(this._participants, this._countEditUsers); this.onParticipantsChanged(this._participants, this._countEditUsers);
this.onConnectionStateChanged(userStateChanged); this.onConnectionStateChanged(userStateChanged);
} }
}
}; };
DocsCoApi.prototype._onDrop = function (data) { DocsCoApi.prototype._onDrop = function (data) {
......
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