summaryrefslogtreecommitdiff
path: root/lib/realtime.js
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lib/realtime.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/realtime.js b/lib/realtime.js
index c9c6543c..a05c1f41 100644
--- a/lib/realtime.js
+++ b/lib/realtime.js
@@ -13,6 +13,7 @@ var moment = require('moment');
//core
var config = require("./config.js");
var logger = require("./logger.js");
+var history = require("./history.js");
var models = require("./models");
//ot
@@ -390,6 +391,12 @@ function finishConnection(socket, note, user) {
note.server.setName(socket, user.name);
note.server.setColor(socket, user.color);
+ // update user note history
+ setTimeout(function () {
+ var noteId = note.alias ? note.alias : LZString.compressToBase64(note.id);
+ history.updateHistory(user.userid, noteId, note.server.document);
+ }, 0);
+
emitOnlineUsers(socket);
emitRefresh(socket);
@@ -468,6 +475,7 @@ function startConnection(socket) {
notes[noteId] = {
id: noteId,
+ alias: note.alias,
owner: owner,
ownerprofile: ownerprofile,
permission: note.permission,
@@ -652,6 +660,12 @@ function operationCallback(socket, operation) {
return logger.error('operation callback failed: ' + err);
});
}
+ // update user note history
+ setTimeout(function() {
+ var noteId = note.alias ? note.alias : LZString.compressToBase64(note.id);
+ history.updateHistory(userId, noteId, note.server.document);
+ }, 0);
+
}
// save authorship
note.authorship = models.Note.updateAuthorshipByOperation(operation, userId, note.authorship);