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