v1.18.x
Barış Soner Uşaklı 4 years ago
parent 1b7ba2c8f1
commit a263897627

@ -144,6 +144,7 @@ module.exports = function (User) {
deleteUserIps(uid),
deleteBans(uid),
deleteUserFromFollowers(uid),
deleteImages(uid),
groups.leaveAllGroups(uid),
]);
await db.deleteAll(['followers:' + uid, 'following:' + uid, 'user:' + uid]);
@ -207,4 +208,13 @@ module.exports = function (User) {
updateCount(followers, 'following:', 'followingCount'),
]);
}
async function deleteImages(uid) {
const extensions = User.getAllowedProfileImageExtensions();
const folder = path.join(nconf.get('upload_path'), 'profile');
await Promise.all(extensions.map(async (ext) => {
await file.delete(path.join(folder, uid + '-profilecover.' + ext));
await file.delete(path.join(folder, uid + '-profileavatar.' + ext));
}));
}
};

Loading…
Cancel
Save