Remove all references to MODULE_ATTACHMENT
authorMatthias Schmidt <gravatronics@live.com>
Sun, 24 May 2020 14:10:43 +0000 (16:10 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Sun, 24 May 2020 14:10:43 +0000 (16:10 +0200)
See WoltLab/WCF#3333

files/lib/data/conversation/message/ConversationMessage.class.php
files/lib/data/conversation/message/ConversationMessageAction.class.php
files/lib/data/conversation/message/ViewableConversationMessageList.class.php
userGroupOption.xml

index 0cf90a970ae05a237b8b09b6a21773bda1f606e5..e05e26ab93900ea07b98811f6dcc2c23efd2c9a7 100644 (file)
@@ -70,7 +70,7 @@ class ConversationMessage extends DatabaseObject implements IMessage {
         * @return      GroupedAttachmentList
         */
        public function getAttachments($ignoreCache = false) {
-               if (MODULE_ATTACHMENT == 1 && ($this->attachments || $ignoreCache)) {
+               if ($this->attachments || $ignoreCache) {
                        $attachmentList = new GroupedAttachmentList('com.woltlab.wcf.conversation.message');
                        $attachmentList->getConditionBuilder()->add('attachment.objectID IN (?)', [$this->messageID]);
                        $attachmentList->readObjects();
index 80042265138b7f9a443f65dc644469b6a7fd6acb..c1c73e1e0db7a7b477a1e96acdeffeda5d00a687 100644 (file)
@@ -382,27 +382,25 @@ class ConversationMessageAction extends AbstractDatabaseObjectAction implements
                        'defaultSmilies' => SmileyCache::getInstance()->getCategorySmilies(),
                        'message' => $this->message,
                        'permissionCanUseSmilies' => 'user.message.canUseSmilies',
-                       'wysiwygSelector' => 'messageEditor'.$this->message->messageID
+                       'wysiwygSelector' => 'messageEditor'.$this->message->messageID,
                ]);
                
-               if (MODULE_ATTACHMENT) {
-                       $tmpHash = StringUtil::getRandomID();
-                       $attachmentHandler = new AttachmentHandler('com.woltlab.wcf.conversation.message', $this->message->messageID, $tmpHash);
-                       $attachmentList = $attachmentHandler->getAttachmentList();
-                               
-                       WCF::getTPL()->assign([
-                               'attachmentHandler' => $attachmentHandler,
-                               'attachmentList' => $attachmentList->getObjects(),
-                               'attachmentObjectID' => $this->message->messageID,
-                               'attachmentObjectType' => 'com.woltlab.wcf.conversation.message',
-                               'attachmentParentObjectID' => 0,
-                               'tmpHash' => $tmpHash
-                       ]);
-               }
+               $tmpHash = StringUtil::getRandomID();
+               $attachmentHandler = new AttachmentHandler('com.woltlab.wcf.conversation.message', $this->message->messageID, $tmpHash);
+               $attachmentList = $attachmentHandler->getAttachmentList();
+               
+               WCF::getTPL()->assign([
+                       'attachmentHandler' => $attachmentHandler,
+                       'attachmentList' => $attachmentList->getObjects(),
+                       'attachmentObjectID' => $this->message->messageID,
+                       'attachmentObjectType' => 'com.woltlab.wcf.conversation.message',
+                       'attachmentParentObjectID' => 0,
+                       'tmpHash' => $tmpHash,
+               ]);
                
                return [
                        'actionName' => 'beginEdit',
-                       'template' => WCF::getTPL()->fetch('conversationMessageInlineEditor')
+                       'template' => WCF::getTPL()->fetch('conversationMessageInlineEditor'),
                ];
        }
        
@@ -442,25 +440,22 @@ class ConversationMessageAction extends AbstractDatabaseObjectAction implements
                $this->message = new ConversationMessage($this->message->messageID);
                $this->message->getAttachments();
                
-               $attachmentList = null;
-               if (MODULE_ATTACHMENT) {
-                       $attachmentList = $this->message->getAttachments(true);
-                       $count = 0;
-                       if ($attachmentList !== null) {
-                               // set permissions
-                               $attachmentList->setPermissions([
-                                       'canDownload' => true,
-                                       'canViewPreview' => true
-                               ]);
-                               
-                               $count = count($attachmentList);
-                       }
+               $attachmentList = $this->message->getAttachments(true);
+               $count = 0;
+               if ($attachmentList !== null) {
+                       // set permissions
+                       $attachmentList->setPermissions([
+                               'canDownload' => true,
+                               'canViewPreview' => true,
+                       ]);
                        
-                       // update count to reflect number of attachments after edit
-                       if ($count != $this->message->attachments) {
-                               $messageEditor = new ConversationMessageEditor($this->message);
-                               $messageEditor->update(['attachments' => $count]);
-                       }
+                       $count = count($attachmentList);
+               }
+               
+               // update count to reflect number of attachments after edit
+               if ($count != $this->message->attachments) {
+                       $messageEditor = new ConversationMessageEditor($this->message);
+                       $messageEditor->update(['attachments' => $count]);
                }
                
                // load embedded objects
@@ -471,13 +466,11 @@ class ConversationMessageAction extends AbstractDatabaseObjectAction implements
                        'message' => $this->message->getFormattedMessage()
                ];
                
-               if (MODULE_ATTACHMENT) {
-                       WCF::getTPL()->assign([
-                               'attachmentList' => $attachmentList,
-                               'objectID' => $this->message->messageID
-                       ]);
-                       $data['attachmentList'] = WCF::getTPL()->fetch('attachments');
-               }
+               WCF::getTPL()->assign([
+                       'attachmentList' => $attachmentList,
+                       'objectID' => $this->message->messageID
+               ]);
+               $data['attachmentList'] = WCF::getTPL()->fetch('attachments');
                
                return $data;
        }
index 148da58883ebe5e983c15058cafe9fda26b4dc72..41ed1404acf698249f095bd653575f002f1ea567 100644 (file)
@@ -132,7 +132,7 @@ class ViewableConversationMessageList extends ConversationMessageList {
         * Reads the list of attachments.
         */
        public function readAttachments() {
-               if (MODULE_ATTACHMENT == 1 && !empty($this->attachmentObjectIDs)) {
+               if (!empty($this->attachmentObjectIDs)) {
                        $this->attachmentList = new GroupedAttachmentList('com.woltlab.wcf.conversation.message');
                        $this->attachmentList->getConditionBuilder()->add('attachment.objectID IN (?)', [$this->attachmentObjectIDs]);
                        $this->attachmentList->readObjects();
index fc7b4455e758483e655192794ff7cf9a01cccbbc..c2ffcfcb8807b3cf87c011383a467a3c2d75e9a2 100644 (file)
                                <categoryname>user.conversation</categoryname>
                                <optiontype>boolean</optiontype>
                                <defaultvalue>1</defaultvalue>
-                               <options>module_attachment</options>
                                <usersonly>1</usersonly>
                        </option>
                        <option name="user.conversation.maxAttachmentSize">
                                <categoryname>user.conversation</categoryname>
                                <optiontype>fileSize</optiontype>
                                <defaultvalue>1000000</defaultvalue>
-                               <options>module_attachment</options>
                                <minvalue>10000</minvalue>
                                <usersonly>1</usersonly>
                        </option>
@@ -136,7 +134,6 @@ bmp
 zip
 txt
 pdf</defaultvalue>
-                               <options>module_attachment</options>
                                <usersonly>1</usersonly>
                                <wildcard>*</wildcard>
                        </option>
@@ -144,7 +141,6 @@ pdf</defaultvalue>
                                <categoryname>user.conversation</categoryname>
                                <optiontype>integer</optiontype>
                                <defaultvalue>5</defaultvalue>
-                               <options>module_attachment</options>
                                <minvalue>1</minvalue>
                                <maxvalue>100</maxvalue>
                                <usersonly>1</usersonly>