ability to delete uploads from account page #6431

This commit is contained in:
Barış Soner Uşaklı
2018-04-09 20:03:33 -04:00
parent 8e822c7772
commit b35bfb81ce
6 changed files with 71 additions and 4 deletions

View File

@@ -2,8 +2,7 @@
var async = require('async');
var _ = require('lodash');
var path = require('path');
var nconf = require('nconf');
var db = require('../database');
var posts = require('../posts');
@@ -57,8 +56,7 @@ module.exports = function (User) {
async.waterfall([
function (next) {
async.each(urls, function (url, next) {
var filePath = path.join(nconf.get('upload_path'), url.replace(nconf.get('upload_url'), ''));
file.delete(filePath, next);
file.delete(file.uploadUrlToPath(url), next);
}, next);
},
function (next) {