Removed embedded objct support for comments
authorAlexander Ebert <ebert@woltlab.com>
Thu, 2 Mar 2017 18:53:56 +0000 (19:53 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Thu, 2 Mar 2017 18:53:56 +0000 (19:53 +0100)
See #2222

wcfsetup/install/files/lib/data/comment/Comment.class.php
wcfsetup/install/files/lib/data/comment/CommentAction.class.php
wcfsetup/install/files/lib/data/comment/StructuredCommentList.class.php
wcfsetup/setup/db/install.sql

index 93da45add3bff49dafe3774b27a15e828788b7e1..52d6cbeb90fe7f421950d0fa05579749c5c03582 100644 (file)
@@ -25,7 +25,6 @@ use wcf\util\StringUtil;
  * @property-read      integer         $responses              number of responses on the comment
  * @property-read      string          $responseIDs            serialized array with the ids of the five latest comment responses
  * @property-read       integer         $enableHtml             is 1 if HTML will rendered in the comment, otherwise 0
- * @property-read       integer         $hasEmbeddedObjects    number of embedded objects in the comment
  */
 class Comment extends DatabaseObject implements IMessage {
        use TUserContent;
index f93918b48604fa03d3346370b9de0ce72af37e9a..d4a2341dbae8fed5ed84468346f888d007a9ff28 100644 (file)
@@ -18,7 +18,6 @@ use wcf\system\exception\SystemException;
 use wcf\system\exception\UserInputException;
 use wcf\system\html\input\HtmlInputProcessor;
 use wcf\system\like\LikeHandler;
-use wcf\system\message\embedded\object\MessageEmbeddedObjectManager;
 use wcf\system\user\activity\event\UserActivityEventHandler;
 use wcf\system\user\notification\object\type\ICommentUserNotificationObjectType;
 use wcf\system\user\notification\object\type\IMultiRecipientCommentUserNotificationObjectType;
@@ -257,13 +256,6 @@ class CommentAction extends AbstractDatabaseObjectAction implements IMessageInli
                        'enableHtml' => 1
                ]);
                
-               // save embedded objects
-               $htmlInputProcessor->setObjectID($this->createdComment->commentID);
-               if (MessageEmbeddedObjectManager::getInstance()->registerObjects($htmlInputProcessor)) {
-                       (new CommentEditor($this->createdComment))->update(['hasEmbeddedObjects' => 1]);
-                       $this->createdComment = new Comment($this->createdComment->commentID);
-               }
-               
                // update counter
                $this->commentProcessor->updateCounter($this->parameters['data']['objectID'], 1);
                
@@ -603,16 +595,6 @@ class CommentAction extends AbstractDatabaseObjectAction implements IMessageInli
                ]);
                $action->executeAction();
                
-               if ($this->comment->hasEmbeddedObjects != MessageEmbeddedObjectManager::getInstance()->registerObjects($htmlInputProcessor)) {
-                       /** @noinspection PhpUndefinedMethodInspection */
-                       $this->comment->update([
-                               'hasEmbeddedObjects' => $this->comment->hasEmbeddedObjects ? 0 : 1
-                       ]);
-               }
-               
-               // load embedded objects
-               MessageEmbeddedObjectManager::getInstance()->loadObjects('com.woltlab.wcf.comment', [$this->comment->commentID]);
-               
                return [
                        'actionName' => 'save',
                        'message' => (new Comment($this->comment->commentID))->getFormattedMessage()
@@ -737,10 +719,6 @@ class CommentAction extends AbstractDatabaseObjectAction implements IMessageInli
         * @return      string
         */
        protected function renderComment(Comment $comment) {
-               if ($comment->hasEmbeddedObjects) {
-                       MessageEmbeddedObjectManager::getInstance()->loadObjects('com.woltlab.wcf.comment', [$comment->commentID]);
-               }
-               
                $comment = new StructuredComment($comment);
                $comment->setIsDeletable($this->commentProcessor->canDeleteComment($comment->getDecoratedObject()));
                $comment->setIsEditable($this->commentProcessor->canEditComment($comment->getDecoratedObject()));
index e9d8870dd6f1d2ea08b667f768ac0ea2d9b87265..fae20b38d44fcc776bf5c6d7d23ddaabdc55a2a4 100644 (file)
@@ -6,7 +6,6 @@ use wcf\data\like\object\LikeObject;
 use wcf\system\cache\runtime\UserProfileRuntimeCache;
 use wcf\system\comment\manager\ICommentManager;
 use wcf\system\like\LikeHandler;
-use wcf\system\message\embedded\object\MessageEmbeddedObjectManager;
 
 /**
  * Provides a structured comment list fetching last responses for every comment.
@@ -73,18 +72,6 @@ class StructuredCommentList extends CommentList {
         */
        public $responseLoading = true;
        
-       /**
-        * enables/disables the loading of embedded objects
-        * @var boolean
-        */
-       protected $embeddedObjectLoading = true;
-       
-       /**
-        * ids of the comments with embedded objects
-        * @var integer[]
-        */
-       protected $embeddedObjectCommentIDs = [];
-       
        /**
         * Creates a new structured comment list.
         * 
@@ -124,10 +111,6 @@ class StructuredCommentList extends CommentList {
                                }
                        }
                        
-                       if ($this->embeddedObjectLoading && $comment->hasEmbeddedObjects) {
-                               $this->embeddedObjectCommentIDs[] = $comment->commentID;
-                       }
-                       
                        if ($comment->userID) {
                                $userIDs[] = $comment->userID;
                        }
@@ -165,10 +148,6 @@ class StructuredCommentList extends CommentList {
                if (!empty($userIDs)) {
                        UserProfileRuntimeCache::getInstance()->cacheObjectIDs(array_unique($userIDs));
                }
-               
-               if ($this->embeddedObjectLoading) {
-                       $this->readEmbeddedObjects();
-               }
        }
        
        /**
@@ -210,14 +189,4 @@ class StructuredCommentList extends CommentList {
        public function getCommentManager() {
                return $this->commentManager;
        }
-       
-       /**
-        * Reads the embedded objects of the posts in the list.
-        */
-       public function readEmbeddedObjects() {
-               if (!empty($this->embeddedObjectCommentIDs)) {
-                       // load embedded objects
-                       MessageEmbeddedObjectManager::getInstance()->loadObjects('com.woltlab.wcf.comment', $this->embeddedObjectCommentIDs);
-               }
-       }
 }
index d3d378d0f314c0ceadb8c2f6a7e4cb49925a2a70..958f3950e1be5d929b2fb481b1a217314f09ae72 100644 (file)
@@ -379,7 +379,6 @@ CREATE TABLE wcf1_comment (
        responses MEDIUMINT(7) NOT NULL DEFAULT '0',
        responseIDs VARCHAR(255) NOT NULL DEFAULT '',
        enableHtml TINYINT(1) NOT NULL DEFAULT 0,
-       hasEmbeddedObjects TINYINT(1) NOT NULL DEFAULT 0,
        
        KEY (objectTypeID, objectID, time),
        KEY lastCommentTime (userID, time)