fix: #7853, dissociation on post purge

This commit is contained in:
Julian Lam
2019-09-04 16:58:58 -04:00
parent effe39895e
commit 30a86ed553
3 changed files with 44 additions and 7 deletions

View File

@@ -108,6 +108,11 @@ module.exports = function (Posts) {
]);
};
Posts.uploads.dissociateAll = async (pid) => {
const current = await Posts.uploads.list(pid);
await Promise.all(current.map(async path => await Posts.uploads.dissociate(pid, path)));
};
Posts.uploads.saveSize = async (filePaths) => {
await Promise.all(filePaths.map(async function (fileName) {
try {