<- sync notebook.udpate[ok]

This commit is contained in:
life
2015-01-25 22:21:42 +08:00
parent 72232dc86e
commit f4d0ce223e
3 changed files with 42 additions and 32 deletions

6
node_modules/notebook.js generated vendored
View File

@@ -242,13 +242,15 @@ var Notebook = {
},
// 更新笔记本
// 这里的notebook是服务器传过来的数据, 需要fix下,
updateNotebookForce: function(notebook, callback) {
updateNotebookForce: function(notebook, notebookLocal, callback) {
var me = this;
notebook.IsDirty = false;
notebook.LocalIsNew = false;
var serverNotebookId = notebook.NotebookId;
me.getNotebookIdByServerNotebookId(notebook.ParentNotebookId, function(parentNotebookId) {
notebook.ParentNotebookId = parentNotebookId;
delete notebook['NotebookId'];
notebook.ServerNotebookId = notebook.NotebookId;
notebook.NotebookId = notebookLocal.NotebookId;
NB.update({ServerNotebookId: serverNotebookId}, {$set: notebook}, {}, function (err, updates) { // Callback is optional
if(err) {
console.log(err);

2
node_modules/sync.js generated vendored
View File

@@ -151,7 +151,7 @@ var Sync = {
} else {
}
// 这里都是用服务器端的数据, 不处理冲突
Notebook.updateNotebookForce(notebook, function(notebook) {
Notebook.updateNotebookForce(notebook, notebookLocal, function(notebook) {
if(notebook) {
me._syncInfo.notebook.updates.push(notebook);
}