From d65eeba3e0d40ffe13b3920c6e39bfc9d8c4bb44 Mon Sep 17 00:00:00 2001 From: Cyperghost Date: Wed, 11 Sep 2024 12:29:05 +0200 Subject: [PATCH] Load embedded content before the email text is processed. --- .../lib/data/article/content/ArticleContent.class.php | 8 ++++++++ wcfsetup/install/files/lib/data/comment/Comment.class.php | 8 ++++++++ .../lib/data/comment/response/CommentResponse.class.php | 8 ++++++++ 3 files changed, 24 insertions(+) diff --git a/wcfsetup/install/files/lib/data/article/content/ArticleContent.class.php b/wcfsetup/install/files/lib/data/article/content/ArticleContent.class.php index d079ffbd2e..43b5273110 100644 --- a/wcfsetup/install/files/lib/data/article/content/ArticleContent.class.php +++ b/wcfsetup/install/files/lib/data/article/content/ArticleContent.class.php @@ -8,6 +8,7 @@ use wcf\data\ILinkableObject; use wcf\data\language\Language; use wcf\system\html\output\HtmlOutputProcessor; use wcf\system\language\LanguageFactory; +use wcf\system\message\embedded\object\MessageEmbeddedObjectManager; use wcf\system\request\IRouteController; use wcf\system\request\LinkHandler; use wcf\system\WCF; @@ -168,6 +169,13 @@ class ArticleContent extends DatabaseObject implements ILinkableObject, IRouteCo */ public function getMailText($mimeType = 'text/plain') { + if ($this->hasEmbeddedObjects) { + MessageEmbeddedObjectManager::getInstance()->loadObjects( + 'com.woltlab.wcf.article.content', + [$this->articleContentID] + ); + } + switch ($mimeType) { case 'text/plain': $processor = new HtmlOutputProcessor(); diff --git a/wcfsetup/install/files/lib/data/comment/Comment.class.php b/wcfsetup/install/files/lib/data/comment/Comment.class.php index c6282e1a0b..eee8275754 100644 --- a/wcfsetup/install/files/lib/data/comment/Comment.class.php +++ b/wcfsetup/install/files/lib/data/comment/Comment.class.php @@ -8,6 +8,7 @@ use wcf\data\TUserContent; use wcf\system\comment\CommentHandler; use wcf\system\comment\manager\ICommentManager; use wcf\system\html\output\HtmlOutputProcessor; +use wcf\system\message\embedded\object\MessageEmbeddedObjectManager; use wcf\util\StringUtil; /** @@ -119,6 +120,13 @@ class Comment extends DatabaseObject implements IMessage */ public function getMailText($mimeType = 'text/plain') { + if ($this->hasEmbeddedObjects) { + MessageEmbeddedObjectManager::getInstance()->loadObjects( + 'com.woltlab.wcf.comment', + [$this->commentID] + ); + } + switch ($mimeType) { case 'text/plain': return $this->getPlainTextMessage(); diff --git a/wcfsetup/install/files/lib/data/comment/response/CommentResponse.class.php b/wcfsetup/install/files/lib/data/comment/response/CommentResponse.class.php index d515db8a71..a9d64d1fd6 100644 --- a/wcfsetup/install/files/lib/data/comment/response/CommentResponse.class.php +++ b/wcfsetup/install/files/lib/data/comment/response/CommentResponse.class.php @@ -9,6 +9,7 @@ use wcf\data\TUserContent; use wcf\system\comment\CommentHandler; use wcf\system\comment\manager\ICommentManager; use wcf\system\html\output\HtmlOutputProcessor; +use wcf\system\message\embedded\object\MessageEmbeddedObjectManager; use wcf\util\StringUtil; /** @@ -83,6 +84,13 @@ class CommentResponse extends DatabaseObject implements IMessage */ public function getMailText($mimeType = 'text/plain') { + if ($this->hasEmbeddedObjects) { + MessageEmbeddedObjectManager::getInstance()->loadObjects( + 'com.woltlab.wcf.comment.response', + [$this->responseID] + ); + } + switch ($mimeType) { case 'text/plain': return $this->getPlainTextMessage(); -- 2.20.1