Fix to handle undefined document on update history

This commit is contained in:
Wu Cheng-Han 2016-10-12 17:50:36 +08:00
parent f3d4b55856
commit c98d263928

View file

@ -396,7 +396,7 @@ function finishConnection(socket, note, user) {
// update user note history // update user note history
setTimeout(function () { setTimeout(function () {
var noteId = note.alias ? note.alias : LZString.compressToBase64(note.id); var noteId = note.alias ? note.alias : LZString.compressToBase64(note.id);
history.updateHistory(user.userid, noteId, note.server.document); if (note.server) history.updateHistory(user.userid, noteId, note.server.document);
}, 0); }, 0);
emitOnlineUsers(socket); emitOnlineUsers(socket);
@ -669,7 +669,7 @@ function operationCallback(socket, operation) {
// update user note history // update user note history
setTimeout(function() { setTimeout(function() {
var noteId = note.alias ? note.alias : LZString.compressToBase64(note.id); var noteId = note.alias ? note.alias : LZString.compressToBase64(note.id);
history.updateHistory(userId, noteId, note.server.document); if (note.server) history.updateHistory(userId, noteId, note.server.document);
}, 0); }, 0);
} }