Skip to content

Commit 7cb9d8d

Browse files
committed
Add exit for user from sync environment
1 parent 0f02cb7 commit 7cb9d8d

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

core/cb.files.sync/environment.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,18 @@ Environment.prototype.userExit = function(user) {
5555
// Remove user from environment
5656
this.removeUser(user);
5757

58-
// Close the file
59-
// then notify other users of departure
60-
return Q(this.pingOthers(user));
58+
var base = Q();
59+
if (this.doc.path != null) {
60+
// Close the file
61+
base = user.close(this.doc.path)
62+
}
63+
64+
var that = this;
6165

66+
// then notify other users of departure
67+
return base.then(function() {
68+
return that.pingOthers(user);
69+
});
6270
};
6371

6472
Environment.prototype.removeUser = function(user) {
@@ -144,7 +152,8 @@ Environment.prototype.getSyncData = function() {
144152
return {
145153
content: this.doc.getContent(),
146154
participants: this.usersInfo(),
147-
state: this.modified
155+
state: this.modified,
156+
path: this.doc.path
148157
};
149158
};
150159

0 commit comments

Comments
 (0)