From e9739cd8068c9847cf94fab70d2f902b319327a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Sun, 1 Nov 2020 13:21:28 +0100 Subject: [PATCH] Delete attachments when deleting messages --- .../lib/data/message/MessageEditor.class.php | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/files/lib/data/message/MessageEditor.class.php b/files/lib/data/message/MessageEditor.class.php index 3551389..4bf77f1 100644 --- a/files/lib/data/message/MessageEditor.class.php +++ b/files/lib/data/message/MessageEditor.class.php @@ -1,11 +1,11 @@ beginTransaction(); + + $result = parent::deleteAll($messageIDs); + if (!empty($messageIDs)) { + AttachmentHandler::removeAttachments('be.bastelstu.chat.message', $messageIDs); + } + + WCF::getDB()->commitTransaction(); + + return $result; + } }