Update to send note title on emit check and refresh event

This commit is contained in:
Wu Cheng-Han 2016-10-10 20:56:22 +08:00
parent 36a1900ce3
commit d6d2cf978a

View file

@ -64,6 +64,7 @@ function secure(socket, next) {
function emitCheck(note) { function emitCheck(note) {
var out = { var out = {
title: note.title,
updatetime: note.updatetime, updatetime: note.updatetime,
lastchangeuser: note.lastchangeuser, lastchangeuser: note.lastchangeuser,
lastchangeuserprofile: note.lastchangeuserprofile, lastchangeuserprofile: note.lastchangeuserprofile,
@ -149,7 +150,7 @@ function updateNote(note, callback) {
function finishUpdateNote(note, _note, callback) { function finishUpdateNote(note, _note, callback) {
if (!note || !note.server) return callback(null, null); if (!note || !note.server) return callback(null, null);
var body = note.server.document; var body = note.server.document;
var title = models.Note.parseNoteTitle(body); var title = note.title = models.Note.parseNoteTitle(body);
title = LZString.compressToBase64(title); title = LZString.compressToBase64(title);
body = LZString.compressToBase64(body); body = LZString.compressToBase64(body);
var values = { var values = {
@ -313,6 +314,7 @@ function emitRefresh(socket) {
if (!noteId || !notes[noteId]) return; if (!noteId || !notes[noteId]) return;
var note = notes[noteId]; var note = notes[noteId];
var out = { var out = {
title: note.title,
docmaxlength: config.documentmaxlength, docmaxlength: config.documentmaxlength,
owner: note.owner, owner: note.owner,
ownerprofile: note.ownerprofile, ownerprofile: note.ownerprofile,
@ -476,6 +478,7 @@ function startConnection(socket) {
notes[noteId] = { notes[noteId] = {
id: noteId, id: noteId,
alias: note.alias, alias: note.alias,
title: LZString.decompressFromBase64(note.title),
owner: owner, owner: owner,
ownerprofile: ownerprofile, ownerprofile: ownerprofile,
permission: note.permission, permission: note.permission,