From: Matthias Schmidt Date: Wed, 9 Jun 2021 13:09:31 +0000 (+0200) Subject: Update `hasEmbeddedObjects` in comment (response) rebuild data worker X-Git-Tag: 5.5.0_Alpha_1~670^2~5 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c7c89f8337446b7a3b3c857f8ea706069f303504;p=GitHub%2FWoltLab%2FWCF.git Update `hasEmbeddedObjects` in comment (response) rebuild data worker --- diff --git a/wcfsetup/install/files/lib/system/worker/CommentRebuildDataWorker.class.php b/wcfsetup/install/files/lib/system/worker/CommentRebuildDataWorker.class.php index d8a23beced..21c345c232 100644 --- a/wcfsetup/install/files/lib/system/worker/CommentRebuildDataWorker.class.php +++ b/wcfsetup/install/files/lib/system/worker/CommentRebuildDataWorker.class.php @@ -7,6 +7,7 @@ use wcf\data\comment\CommentEditor; use wcf\data\comment\CommentList; use wcf\system\bbcode\BBCodeHandler; use wcf\system\html\input\HtmlInputProcessor; +use wcf\system\message\embedded\object\MessageEmbeddedObjectManager; use wcf\system\WCF; /** @@ -92,6 +93,8 @@ class CommentRebuildDataWorker extends AbstractRebuildDataWorker $this->getBulkUserPermissionValue($userPermissions, $comment->userID, 'user.comment.disallowedBBCodes') )); + $data = []; + // update message if (!$comment->enableHtml) { $this->getHtmlInputProcessor()->process( @@ -101,18 +104,23 @@ class CommentRebuildDataWorker extends AbstractRebuildDataWorker true ); - $commentEditor->update([ - 'message' => $this->getHtmlInputProcessor()->getHtml(), - 'enableHtml' => 1, - ]); + $data['enableHtml'] = 1; } else { $this->getHtmlInputProcessor()->reprocess( $comment->message, 'com.woltlab.wcf.comment', $comment->commentID ); - $commentEditor->update(['message' => $this->getHtmlInputProcessor()->getHtml()]); } + + if (MessageEmbeddedObjectManager::getInstance()->registerObjects($this->getHtmlInputProcessor(), true)) { + $data['hasEmbeddedObjects'] = 1; + } else { + $data['hasEmbeddedObjects'] = 0; + } + + $data['message'] = $this->getHtmlInputProcessor()->getHtml(); + $commentEditor->update($data); } WCF::getDB()->commitTransaction(); } diff --git a/wcfsetup/install/files/lib/system/worker/CommentResponseRebuildDataWorker.class.php b/wcfsetup/install/files/lib/system/worker/CommentResponseRebuildDataWorker.class.php index 6cb4e68f7e..1a34ffe5fb 100644 --- a/wcfsetup/install/files/lib/system/worker/CommentResponseRebuildDataWorker.class.php +++ b/wcfsetup/install/files/lib/system/worker/CommentResponseRebuildDataWorker.class.php @@ -7,6 +7,7 @@ use wcf\data\comment\response\CommentResponseEditor; use wcf\data\comment\response\CommentResponseList; use wcf\system\bbcode\BBCodeHandler; use wcf\system\html\input\HtmlInputProcessor; +use wcf\system\message\embedded\object\MessageEmbeddedObjectManager; use wcf\system\WCF; /** @@ -89,6 +90,8 @@ class CommentResponseRebuildDataWorker extends AbstractRebuildDataWorker $this->getBulkUserPermissionValue($userPermissions, $response->userID, 'user.comment.disallowedBBCodes') )); + $data = []; + // update message if (!$response->enableHtml) { $this->getHtmlInputProcessor()->process( @@ -98,18 +101,23 @@ class CommentResponseRebuildDataWorker extends AbstractRebuildDataWorker true ); - $responseEditor->update([ - 'message' => $this->getHtmlInputProcessor()->getHtml(), - 'enableHtml' => 1, - ]); + $data['enableHtml'] = 1; } else { $this->getHtmlInputProcessor()->reprocess( $response->message, 'com.woltlab.wcf.comment.response', $response->responseID ); - $responseEditor->update(['message' => $this->getHtmlInputProcessor()->getHtml()]); } + + if (MessageEmbeddedObjectManager::getInstance()->registerObjects($this->getHtmlInputProcessor(), true)) { + $data['hasEmbeddedObjects'] = 1; + } else { + $data['hasEmbeddedObjects'] = 0; + } + + $data['message'] = $this->getHtmlInputProcessor()->getHtml(); + $responseEditor->update($data); } WCF::getDB()->commitTransaction(); }