fix: Uploaded and immediately deleted images are not removed from storage (#4562)
* fix: Uploaded and immediately deleted images are not removed from storage upon permanant delete closes #4557 * Move attachment deletion async
This commit is contained in:
@@ -2,12 +2,19 @@ import { Attachment } from "@server/models";
|
||||
import BaseTask from "./BaseTask";
|
||||
|
||||
type Props = {
|
||||
teamId: string;
|
||||
attachmentId: string;
|
||||
};
|
||||
|
||||
export default class DeleteAttachmentTask extends BaseTask<Props> {
|
||||
public async perform({ attachmentId }: Props) {
|
||||
const attachment = await Attachment.findByPk(attachmentId);
|
||||
public async perform({ attachmentId, teamId }: Props) {
|
||||
const attachment = await Attachment.findOne({
|
||||
where: {
|
||||
teamId,
|
||||
id: attachmentId,
|
||||
},
|
||||
});
|
||||
|
||||
if (!attachment) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user