mirror of
https://github.com/leanote/desktop-app.git
synced 2025-10-15 15:41:19 +00:00
set blog
成功后才显示blog标志, 可点
This commit is contained in:
4
node_modules/api.js
generated
vendored
4
node_modules/api.js
generated
vendored
@@ -507,7 +507,8 @@ var Api = {
|
||||
Content: note.Content,
|
||||
IsMarkdown: note.IsMarkdown,
|
||||
Tags: note.Tags,
|
||||
IsBlog: false, // TODO 这里永远设为非blog note.IsBlog,
|
||||
// IsBlog: false, // TODO 这里永远设为非blog note.IsBlog,
|
||||
IsBlog: note.IsBlog,
|
||||
Files: note.Files,
|
||||
FileDatas: note.FileDatas,
|
||||
}
|
||||
@@ -560,6 +561,7 @@ var Api = {
|
||||
usn: note.Usn,
|
||||
isTrash: note.IsTrash,
|
||||
content: note.Content,
|
||||
isBlog: note.IsBlog, // 是否是博客
|
||||
Files: note.Files,
|
||||
FileDatas: note.FileDatas,
|
||||
tags: note.Tags, // 新添加
|
||||
|
25
node_modules/note.js
generated
vendored
25
node_modules/note.js
generated
vendored
@@ -153,6 +153,24 @@ var Note = {
|
||||
}
|
||||
},
|
||||
|
||||
// 公开/取消为博客
|
||||
setNote2Blog: function(noteId, isBlog, callback) {
|
||||
var me = this;
|
||||
me.getNote(noteId, function(note) {
|
||||
if(note) {
|
||||
if(note.IsBlog == isBlog) {
|
||||
return callback && callback(true);
|
||||
}
|
||||
// 更新, 设置isDirty
|
||||
Notes.update({NoteId: noteId}, { $set: {IsBlog: isBlog, IsDirty: true} }, {}, function (err, numReplaced) {
|
||||
return callback && callback(true);
|
||||
});
|
||||
} else {
|
||||
return callback && callback(false);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 添加笔记历史
|
||||
/*
|
||||
type NoteContentHistory struct {
|
||||
@@ -1102,6 +1120,13 @@ var Note = {
|
||||
|
||||
// 处理删除的
|
||||
Web.deleteSyncNote(noteSyncInfo.deletes);
|
||||
|
||||
// 为了博客
|
||||
var changeAdds = noteSyncInfo.changeAdds || [];
|
||||
var changeUpdates = noteSyncInfo.changeUpdates || [];
|
||||
changeAdds = changeAdds.concat(changeUpdates);
|
||||
Web.updateNoteCacheForServer(changeAdds);
|
||||
|
||||
},
|
||||
|
||||
// 得到所有文件要传的基本信息和传送的数据
|
||||
|
7
node_modules/sync.js
generated
vendored
7
node_modules/sync.js
generated
vendored
@@ -72,7 +72,7 @@ var Sync = {
|
||||
// 同步信息
|
||||
me._syncInfo = {
|
||||
notebook: {ok: false, changeAdds: [], changeConflicts: [], changeNeedAdds: [], adds: [], deletes: [], updates: []},
|
||||
note: {ok: false, adds: [], changeAdds: [], changeConflicts: [], changeNeedAdds: [], deletes: [], updates: [], conflicts: []},
|
||||
note: {ok: false, adds: [], changeAdds: [], changeConflicts: [], changeUpdates:[], changeNeedAdds: [], deletes: [], updates: [], conflicts: []},
|
||||
tag: {ok: false, adds: [], changeAdds: [], changeConflicts: [], changeNeedAdds: [], deletes: [], updates: [], conflicts: []},
|
||||
};
|
||||
|
||||
@@ -736,7 +736,7 @@ var Sync = {
|
||||
// 一个一个同步执行, 因为要有
|
||||
async.eachSeries(notes, function(note, cb) {
|
||||
if(note.LocalIsNew) {
|
||||
// 添加
|
||||
// 添加, newNote的返回不会很多值(server端)
|
||||
Api.addNote(note, function(newNote) {
|
||||
if(!Common.isOk(newNote)) {
|
||||
return cb();
|
||||
@@ -744,6 +744,8 @@ var Sync = {
|
||||
|
||||
newNote.ServerNoteId = newNote.NoteId;
|
||||
newNote.NoteId = note.NoteId;
|
||||
|
||||
newNote.IsBlog = note.IsBlog; // 前端要用
|
||||
me._syncInfo.note.changeAdds.push(newNote);
|
||||
|
||||
Note.updateNoteForceForSendChange(newNote, true);
|
||||
@@ -785,6 +787,7 @@ var Sync = {
|
||||
ret.ServerNoteId = ret.NoteId;
|
||||
ret.NoteId = note.NoteId;
|
||||
Note.updateNoteForceForSendChange(ret, false);
|
||||
me._syncInfo.note.changeUpdates.push(note);
|
||||
|
||||
me.checkNeedIncSyncAgain(ret.Usn);
|
||||
|
||||
|
4
node_modules/web.js
generated
vendored
4
node_modules/web.js
generated
vendored
@@ -74,6 +74,10 @@ var Web = {
|
||||
var me = this;
|
||||
me.Note.fixSyncConflict(note, newNote);
|
||||
},
|
||||
updateNoteCacheForServer: function(notes) {
|
||||
var me = this;
|
||||
me.Note.updateNoteCacheForServer(notes);
|
||||
},
|
||||
//--------------
|
||||
|
||||
syncFinished: function() {
|
||||
|
Reference in New Issue
Block a user