Missing check if message is no longer a draft
authorMarcel Werk <burntime@woltlab.com>
Wed, 6 Apr 2022 11:06:50 +0000 (13:06 +0200)
committerMarcel Werk <burntime@woltlab.com>
Wed, 6 Apr 2022 11:06:50 +0000 (13:06 +0200)
files/lib/form/ConversationDraftEditForm.class.php

index b4a4b7b33e5619ded1b4a85b97cc10ade1ec91f5..a3624000a9ad3f3a6e14c45c3c325b2c025c5b24 100644 (file)
@@ -83,21 +83,23 @@ class ConversationDraftEditForm extends ConversationAddForm
         $messageAction->executeAction();
 
         // Update timestamp of other messages in this draft.
-        $list = new ConversationMessageList();
-        $list->getConditionBuilder()->add('conversationID = ?', [$this->conversation->conversationID]);
-        $list->getConditionBuilder()->add('messageID <> ?', [$this->conversation->getFirstMessage()->messageID]);
-        $list->readObjectIDs();
-        if (\count($list->getObjectIDs())) {
-            $messageAction = new ConversationMessageAction(
-                $list->getObjectIDs(),
-                'update',
-                [
-                    'data' => [
-                        'time' => TIME_NOW,
-                    ],
-                ]
-            );
-            $messageAction->executeAction();
+        if (!$this->draft) {
+            $list = new ConversationMessageList();
+            $list->getConditionBuilder()->add('conversationID = ?', [$this->conversation->conversationID]);
+            $list->getConditionBuilder()->add('messageID <> ?', [$this->conversation->getFirstMessage()->messageID]);
+            $list->readObjectIDs();
+            if (\count($list->getObjectIDs())) {
+                $messageAction = new ConversationMessageAction(
+                    $list->getObjectIDs(),
+                    'update',
+                    [
+                        'data' => [
+                            'time' => TIME_NOW,
+                        ],
+                    ]
+                );
+                $messageAction->executeAction();
+            }
         }
 
         // save conversation