mirror of
https://github.com/leanote/desktop-app.git
synced 2025-10-16 08:01:53 +00:00
删除笔记后, 删除附件
This commit is contained in:
11
node_modules/note.js
generated
vendored
11
node_modules/note.js
generated
vendored
@@ -385,6 +385,8 @@ var Note = {
|
||||
// TODO 删除附件
|
||||
db.notes.update({_id: note._id}, {$set: {IsDirty: true, LocalIsDelete: true}}, function(err, n) {
|
||||
if(n) {
|
||||
// 删除附件
|
||||
me.deleteAttachs(note.Attachs);
|
||||
// 删除历史记录
|
||||
me.deleteNoteHistory(note.NoteId);
|
||||
// 如果有tags, 则重新更新tags' count
|
||||
@@ -702,6 +704,8 @@ var Note = {
|
||||
if(err) {
|
||||
callback && callback(false);
|
||||
} else {
|
||||
// 删除附件
|
||||
me.deleteAttachs(note.Attachs);
|
||||
// 删除历史记录
|
||||
me.deleteNoteHistory(noteId);
|
||||
Notebook.reCountNotebookNumberNotes(note.NotebookId);
|
||||
@@ -1508,12 +1512,13 @@ var Note = {
|
||||
},
|
||||
|
||||
// 删除附件, 在sync时
|
||||
// 或者, 在删除笔记后
|
||||
deleteAttachs: function(attachs) {
|
||||
var me = this;
|
||||
var fileBasePath = User.getCurUserAttachsPath();
|
||||
if(!attachs) {
|
||||
if (!attachs || attachs.length == 0) {
|
||||
return;
|
||||
}
|
||||
var me = this;
|
||||
var fileBasePath = User.getCurUserAttachsPath();
|
||||
for(var i in attachs) {
|
||||
var path = attachs[i].Path;
|
||||
if(path && path.indexOf(fileBasePath) > 0) {
|
||||
|
Reference in New Issue
Block a user