mirror of
https://github.com/leanote/desktop-app.git
synced 2025-10-16 08:01:53 +00:00
删除用户优化
This commit is contained in:
3
node_modules/common.js
generated
vendored
3
node_modules/common.js
generated
vendored
@@ -276,13 +276,14 @@ var Common = {
|
|||||||
|
|
||||||
// 删除文件夹
|
// 删除文件夹
|
||||||
deleteFolderRecursive: function(path) {
|
deleteFolderRecursive: function(path) {
|
||||||
|
var me = this;
|
||||||
var files = [];
|
var files = [];
|
||||||
if( fs.existsSync(path) ) {
|
if( fs.existsSync(path) ) {
|
||||||
files = fs.readdirSync(path);
|
files = fs.readdirSync(path);
|
||||||
files.forEach(function(file,index){
|
files.forEach(function(file,index){
|
||||||
var curPath = path + "/" + file;
|
var curPath = path + "/" + file;
|
||||||
if(fs.statSync(curPath).isDirectory()) { // recurse
|
if(fs.statSync(curPath).isDirectory()) { // recurse
|
||||||
deleteFolderRecursive(curPath);
|
me.deleteFolderRecursive(curPath);
|
||||||
} else { // delete file
|
} else { // delete file
|
||||||
fs.unlinkSync(curPath);
|
fs.unlinkSync(curPath);
|
||||||
}
|
}
|
||||||
|
17
node_modules/user.js
generated
vendored
17
node_modules/user.js
generated
vendored
@@ -251,11 +251,14 @@ User = {
|
|||||||
return 'data/' + this.getCurActiveUserId() + '/attachs';
|
return 'data/' + this.getCurActiveUserId() + '/attachs';
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getUserImagesAndAttachBasePath: function(userId) {
|
||||||
|
return Evt.getBasePath() + '/data/' + userId;
|
||||||
|
},
|
||||||
getUserImagesPath: function(userId) {
|
getUserImagesPath: function(userId) {
|
||||||
return Evt.getBasePath() + '/data/' + userId + '/images';
|
return this.getUserImagesAndAttachBasePath() + '/images';
|
||||||
},
|
},
|
||||||
getUserAttachsPath: function(userId) {
|
getUserAttachsPath: function(userId) {
|
||||||
return Evt.getBasePath() + '/data/' + userId + '/attachs';
|
return this.getUserImagesAndAttachBasePath() + '/attachs';
|
||||||
},
|
},
|
||||||
|
|
||||||
getUserDBPath: function (userId) {
|
getUserDBPath: function (userId) {
|
||||||
@@ -275,13 +278,9 @@ User = {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var imagesPath = me.getUserImagesPath(userId);
|
var imagesAndAttachBasePath = me.getUserImagesAndAttachBasePath(userId);
|
||||||
var attachsPath = me.getUserAttachsPath(userId);
|
if (imagesAndAttachBasePath) {
|
||||||
if (imagesPath) {
|
Common.deleteFolderRecursive(imagesAndAttachBasePath);
|
||||||
Common.deleteFolderRecursive(imagesPath);
|
|
||||||
}
|
|
||||||
if (attachsPath) {
|
|
||||||
Common.deleteFolderRecursive(attachsPath);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@@ -366,7 +366,7 @@ define(function() {
|
|||||||
return callback();
|
return callback();
|
||||||
}
|
}
|
||||||
async.eachSeries(notes, function (note, cb) {
|
async.eachSeries(notes, function (note, cb) {
|
||||||
Api.dbService.noteHistories.remove( {_id: note.NoteId}, { multi: true }, function () {
|
sourceDb.noteHistories.remove( {_id: note.NoteId}, { multi: true }, function () {
|
||||||
cb();
|
cb();
|
||||||
});
|
});
|
||||||
}, function () {
|
}, function () {
|
||||||
|
Reference in New Issue
Block a user