mirror of
https://github.com/leanote/desktop-app.git
synced 2025-10-15 23:55:50 +00:00
conflict ok
todo conflict copy attach
This commit is contained in:
4
node_modules/api.js
generated
vendored
4
node_modules/api.js
generated
vendored
@@ -427,11 +427,13 @@ var Api = {
|
|||||||
var ret = resp.body;
|
var ret = resp.body;
|
||||||
log('update note ret:');
|
log('update note ret:');
|
||||||
log(ret);
|
log(ret);
|
||||||
if(Common.isOk(ret)) {
|
|
||||||
callback(ret);
|
callback(ret);
|
||||||
|
/*
|
||||||
|
if(Common.isOk(ret)) {
|
||||||
} else {
|
} else {
|
||||||
callback(false);
|
callback(false);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
8
node_modules/note.js
generated
vendored
8
node_modules/note.js
generated
vendored
@@ -574,10 +574,12 @@ var Note = {
|
|||||||
|
|
||||||
// 将本地冲突的笔记复制一份
|
// 将本地冲突的笔记复制一份
|
||||||
// serverNoteId
|
// serverNoteId
|
||||||
|
// TODO 附件也要复制一份
|
||||||
copyNoteForConfict: function(noteId, callback) {
|
copyNoteForConfict: function(noteId, callback) {
|
||||||
var me = this;
|
var me = this;
|
||||||
me.getNote(noteId, function(note) {
|
me.getNote(noteId, function(note) {
|
||||||
if(!note) {
|
if(!note) {
|
||||||
|
callback(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 新Id
|
// 新Id
|
||||||
@@ -646,6 +648,8 @@ var Note = {
|
|||||||
// 复制一份
|
// 复制一份
|
||||||
// [待测]
|
// [待测]
|
||||||
var changeConflicts = noteSyncInfo.changeConflicts;
|
var changeConflicts = noteSyncInfo.changeConflicts;
|
||||||
|
console.log('changeConflicts');
|
||||||
|
console.log(changeConflicts);
|
||||||
for(var i in changeConflicts) {
|
for(var i in changeConflicts) {
|
||||||
var note = changeConflicts[i]; // note是本地的note
|
var note = changeConflicts[i]; // note是本地的note
|
||||||
// 复制一份
|
// 复制一份
|
||||||
@@ -659,8 +663,8 @@ var Note = {
|
|||||||
Api.getNote(note.ServerNoteId, function(serverNote) {
|
Api.getNote(note.ServerNoteId, function(serverNote) {
|
||||||
serverNote.ServerNoteId = serverNote.NoteId;
|
serverNote.ServerNoteId = serverNote.NoteId;
|
||||||
serverNote.NoteId = note.NoteId;
|
serverNote.NoteId = note.NoteId;
|
||||||
me.updateNoteForceForConflict(serverNote, function(err, note2) {
|
me.updateNoteForceForConflict(serverNote, function(note2) {
|
||||||
if(!err) {
|
if(!note2) {
|
||||||
// 前端来处理, 全量sync时不用前端一个个处理
|
// 前端来处理, 全量sync时不用前端一个个处理
|
||||||
noteWeb && noteWeb.fixSyncConflict(note2, newNote);
|
noteWeb && noteWeb.fixSyncConflict(note2, newNote);
|
||||||
}
|
}
|
||||||
|
9
node_modules/sync.js
generated
vendored
9
node_modules/sync.js
generated
vendored
@@ -559,16 +559,17 @@ var Sync = {
|
|||||||
return cb();
|
return cb();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
console.log('local');
|
|
||||||
console.log(note);
|
|
||||||
// 更新
|
// 更新
|
||||||
Api.updateNote(note, function(ret) {
|
Api.updateNote(note, function(ret) {
|
||||||
if(!Common.isOk(ret)) {
|
if(!Common.isOk(ret)) {
|
||||||
|
console.log('updateNote eeeeeeeeeeror');
|
||||||
|
console.log(ret);
|
||||||
if(typeof ret == 'object') {
|
if(typeof ret == 'object') {
|
||||||
if(ret.msg == 'conflict') {
|
if(ret.Msg == 'conflict') {
|
||||||
|
console.log('updateNote 冲突-----------');
|
||||||
me._syncInfo.note.changeConflicts.push(note);
|
me._syncInfo.note.changeConflicts.push(note);
|
||||||
}
|
}
|
||||||
else if(newNote.Msg == 'notExists') {
|
else if(ret.Msg == 'notExists') {
|
||||||
// 可能服务器上已删除, 此时应该要作为添加而不是更新
|
// 可能服务器上已删除, 此时应该要作为添加而不是更新
|
||||||
me._syncInfo.note.changeNeedAdds.push(note);
|
me._syncInfo.note.changeNeedAdds.push(note);
|
||||||
}
|
}
|
||||||
|
@@ -27,6 +27,9 @@ html, body {
|
|||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
border: 1px solid #000;
|
border: 1px solid #000;
|
||||||
}
|
}
|
||||||
|
#noteItemList .item-conflict {
|
||||||
|
border: 1px solid #E4DA2D;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
<!-- For Develop writting mod -->
|
<!-- For Develop writting mod -->
|
||||||
<script>
|
<script>
|
||||||
|
@@ -894,6 +894,9 @@ Note._renderNotes = function(notes, forNewNote, isShared, tang) { // 第几趟
|
|||||||
tmp = $(tmp);
|
tmp = $(tmp);
|
||||||
tmp.find(".item-blog").hide();
|
tmp.find(".item-blog").hide();
|
||||||
}
|
}
|
||||||
|
if(note.ConflictNoteId) {
|
||||||
|
$(tmp).addClass('item-conflict');
|
||||||
|
}
|
||||||
Note.noteItemListO.append(tmp);
|
Note.noteItemListO.append(tmp);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1978,6 +1981,7 @@ Note.fixSyncConflict = function(note, newNote) {
|
|||||||
}
|
}
|
||||||
// 当前这个换成新复制的
|
// 当前这个换成新复制的
|
||||||
target.attr('noteId', newNote.NoteId);
|
target.attr('noteId', newNote.NoteId);
|
||||||
|
target.addClass('item-conflict');
|
||||||
// 重新render 左侧下, 因为有冲突了, 不要render内容啊
|
// 重新render 左侧下, 因为有冲突了, 不要render内容啊
|
||||||
|
|
||||||
// 如果当前编辑的是这个笔记, 那切换到newNote上来
|
// 如果当前编辑的是这个笔记, 那切换到newNote上来
|
||||||
|
Reference in New Issue
Block a user