mirror of
https://github.com/leanote/desktop-app.git
synced 2025-10-14 15:11:24 +00:00
避免trash的笔记一同步变成不是trash的了
This commit is contained in:
12
node_modules/note.js
generated
vendored
12
node_modules/note.js
generated
vendored
@@ -704,13 +704,19 @@ var Note = {
|
||||
note.InitSync = true; // 刚同步完, 表示content, images, attach没有同步
|
||||
note.IsDirty = false;
|
||||
note.LocalIsDelete = false;
|
||||
note.IsTrash = false;
|
||||
// 这里, 悲剧, 一个大BUG, 应该和server端IsTrash一致,
|
||||
// 不然同步的时候将IsTrash的笔记同步到非IsTrash, 2015/10/31 fixed 谢谢 3601提供的信息
|
||||
// note.IsTrash = false;
|
||||
if (typeof note.IsTrash == 'boolean') {
|
||||
note.IsTrash = note.IsTrash;
|
||||
}
|
||||
else {
|
||||
note.IsTrash = false;
|
||||
}
|
||||
|
||||
note.ServerNoteId = note.NoteId;
|
||||
note.NoteId = Common.objectId();
|
||||
|
||||
console.error('add note force' + note.Title + Common.goNowToDate(note.CreatedTime));
|
||||
|
||||
note.CreatedTime = Common.goNowToDate(note.CreatedTime);
|
||||
note.UpdatedTime = Common.goNowToDate(note.UpdatedTime);
|
||||
|
||||
|
@@ -745,9 +745,9 @@ Note.reRenderNote = function(noteId) {
|
||||
NoteService.getNoteContent(noteId, function(noteContent) {
|
||||
if(noteContent) {
|
||||
Note.setNoteCache(noteContent, false);
|
||||
Attach.renderNoteAttachNum(noteId, true);
|
||||
// 确保重置的是当前note
|
||||
if (Note.curNoteId === noteId) {
|
||||
Attach.renderNoteAttachNum(noteId, true);
|
||||
Note.renderNoteContent(noteContent, true);
|
||||
}
|
||||
}
|
||||
@@ -789,9 +789,7 @@ Note.renderChangedNote = function(changedNote) {
|
||||
$leftNoteNav.find(".item-thumb").remove(); // 以前有, 现在没有了
|
||||
$leftNoteNav.removeClass("item-image");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
// 清空右侧note信息, 可能是共享的,
|
||||
// 此时需要清空只读的, 且切换到note edit模式下
|
||||
@@ -822,7 +820,7 @@ Note.clearAll = function() {
|
||||
|
||||
Note.clearNoteInfo();
|
||||
Note.clearNoteList();
|
||||
}
|
||||
};
|
||||
|
||||
// render到编辑器
|
||||
// render note
|
||||
@@ -977,6 +975,10 @@ Note._getNoteHtmlObjct = function(note, isShared) {
|
||||
baseClasses = "item-shared";
|
||||
}
|
||||
var classes = baseClasses;
|
||||
if (note.IsDeleted) {
|
||||
console.error('_getNoteHtmlObjct note.IsDeleted');
|
||||
return;
|
||||
}
|
||||
|
||||
var tmp;
|
||||
if(note.ImgSrc) {
|
||||
@@ -1011,6 +1013,11 @@ Note._renderNotes = function(notes, forNewNote, isShared, tang) { // 第几趟
|
||||
var note = notes[i];
|
||||
note.Title = trimTitle(note.Title);
|
||||
|
||||
if (note.IsDeleted) {
|
||||
console.error('note.IsDeleted');
|
||||
continue;
|
||||
}
|
||||
|
||||
if(note.InitSync) {
|
||||
Note.getNoteContentLazy(note.NoteId);
|
||||
}
|
||||
@@ -3295,19 +3302,26 @@ Note.addSync = function(notes) {
|
||||
}
|
||||
for(var i in notes) {
|
||||
var note = notes[i];
|
||||
Note.addNoteCache(note);
|
||||
// 避免trash的也加进来
|
||||
if (!note.IsDeleted) {
|
||||
if (
|
||||
(note.IsTrash && Notebook.curNotebookIsTrash())
|
||||
|| !note.IsTrash) {
|
||||
|
||||
console.log(note);
|
||||
Note.addNoteCache(note);
|
||||
|
||||
// 很可能其笔记本也是新添加的, 此时重新render notebooks' numberNotes
|
||||
Notebook.reRenderNotebookNumberNotesIfIsNewNotebook(note.NotebookId);
|
||||
// 很可能其笔记本也是新添加的, 此时重新render notebooks' numberNotes
|
||||
Notebook.reRenderNotebookNumberNotesIfIsNewNotebook(note.NotebookId);
|
||||
|
||||
// alert(note.ServerNoteId);
|
||||
// 添加到当前的笔记列表中
|
||||
var newHtmlObject = Note._getNoteHtmlObjct(note);
|
||||
$('#noteItemList').prepend(newHtmlObject);
|
||||
|
||||
Note.setNoteBlogVisible(note.NoteId, note.IsBlog);
|
||||
// alert(note.ServerNoteId);
|
||||
// 添加到当前的笔记列表中
|
||||
var newHtmlObject = Note._getNoteHtmlObjct(note);
|
||||
if (newHtmlObject) {
|
||||
$('#noteItemList').prepend(newHtmlObject);
|
||||
Note.setNoteBlogVisible(note.NoteId, note.IsBlog);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user