From cc2f48e4e6bd2eef312a08d34cf7bcaedb8a8105 Mon Sep 17 00:00:00 2001 From: Yuriy Bakhtin Date: Thu, 22 Feb 2024 16:50:04 +0100 Subject: [PATCH] Remove message entries on disable module (#381) --- Module.php | 13 +++++++++++++ docs/CHANGELOG.md | 3 +++ module.json | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Module.php b/Module.php index 203cf006..d3a0a1ed 100644 --- a/Module.php +++ b/Module.php @@ -3,6 +3,7 @@ namespace humhub\modules\mail; use humhub\components\console\Application as ConsoleApplication; +use humhub\modules\mail\models\MessageEntry; use humhub\modules\mail\notifications\MailNotification; use humhub\modules\mail\notifications\ConversationNotification; use humhub\modules\mail\permissions\StartConversation; @@ -110,4 +111,16 @@ public function hideInTopNav() return !$this->settings->get('showInTopNav', false); } + /** + * @inheritdoc + */ + public function disable() + { + foreach (MessageEntry::find()->each() as $messageEntry) { + $messageEntry->delete(); + } + + parent::disable(); + } + } diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index b49db6c4..7076c4a7 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,6 +1,9 @@ Changelog ========= +3.2.1 (Unreleased) +------------------------ +- Enh #370: Remove message entries on disable module 3.2.0 (January 29, 2024) ------------------------ diff --git a/module.json b/module.json index 8f7f95e1..58b6a157 100644 --- a/module.json +++ b/module.json @@ -8,7 +8,7 @@ "messenger", "communication" ], - "version": "3.2.0", + "version": "3.2.1", "humhub": { "minVersion": "1.15" },