Fixed small issues
authorMarcel Werk <burntime@woltlab.com>
Mon, 8 Apr 2013 15:31:43 +0000 (17:31 +0200)
committerMarcel Werk <burntime@woltlab.com>
Mon, 8 Apr 2013 15:31:43 +0000 (17:31 +0200)
files/lib/data/conversation/ConversationAction.class.php
files/lib/form/ConversationAddForm.class.php
files/lib/form/ConversationMessageAddForm.class.php
files/lib/form/ConversationMessageEditForm.class.php

index 9eecede8f936354a9d2f468035335a9708ba142d..0a3be262c4fef1cde87d1629b4ad2ad24cd44d87 100644 (file)
@@ -80,6 +80,14 @@ class ConversationAction extends AbstractDatabaseObjectAction implements IClipbo
                        // fire notification event
                        $notificationRecipients = array_merge((!empty($this->parameters['participants']) ? $this->parameters['participants'] : array()), (!empty($this->parameters['invisibleParticipants']) ? $this->parameters['invisibleParticipants'] : array()));
                        UserNotificationHandler::getInstance()->fireEvent('conversation', 'com.woltlab.wcf.conversation.notification', new ConversationUserNotificationObject($conversation), $notificationRecipients);
+                       
+                       // mark conversation as read for the author
+                       $sql = "UPDATE  wcf".WCF_N."_conversation_to_user
+                               SET     lastVisitTime = ?
+                               WHERE   participantID = ?
+                                       AND conversationID = ?";
+                       $statement = WCF::getDB()->prepareStatement($sql);
+                       $statement->execute(array($data['time'], $data['userID'], $conversation->conversationID));
                }
                else {
                        // update conversation count
@@ -90,16 +98,14 @@ class ConversationAction extends AbstractDatabaseObjectAction implements IClipbo
                $conversationEditor->updateParticipantSummary();
                
                // create message
-               $data = array(
-                       'conversationID' => $conversation->conversationID,
-                       'message' => $this->parameters['messageData']['message'],
-                       'time' => $this->parameters['data']['time'],
-                       'userID' => $this->parameters['data']['userID'],
-                       'username' => $this->parameters['data']['username']
-               );
+               $messageData = $this->parameters['messageData'];
+               $messageData['conversationID'] = $conversation->conversationID;
+               $messageData['time'] = $this->parameters['data']['time'];
+               $messageData['userID'] = $this->parameters['data']['userID'];
+               $messageData['username'] = $this->parameters['data']['username'];
                
                $messageAction = new ConversationMessageAction(array(), 'create', array(
-                       'data' => $data,
+                       'data' => $messageData,
                        'conversation' => $conversation,
                        'isFirstPost' => true,
                        'attachmentHandler' => (isset($this->parameters['attachmentHandler']) ? $this->parameters['attachmentHandler'] : null) 
@@ -536,11 +542,11 @@ class ConversationAction extends AbstractDatabaseObjectAction implements IClipbo
                // unmark items
                $this->unmarkItems();
                
-               // update participant summary
-               ConversationEditor::updateParticipantSummaries($this->objectIDs);
-               
-               // delete conversation if all users have left it
                if ($this->parameters['hideConversation'] == Conversation::STATE_LEFT) {
+                       // update participant summary
+                       ConversationEditor::updateParticipantSummaries($this->objectIDs);
+                       
+                       // delete conversation if all users have left it
                        $conditionBuilder = new PreparedStatementConditionBuilder();
                        $conditionBuilder->add('conversation.conversationID IN (?)', array($this->objectIDs));
                        $conditionBuilder->add('conversation_to_user.conversationID IS NULL');
index 997b65ca65b450cc76d625bd4c6419b8db3246be..7acd3b7aa91c1909cb1ef45b8bbce2196aba25cc 100644 (file)
@@ -183,7 +183,11 @@ class ConversationAddForm extends MessageForm {
                        'data' => $data,
                        'attachmentHandler' => $this->attachmentHandler,
                        'messageData' => array(
-                               'message' => $this->text
+                               'message' => $this->text,
+                               'enableBBCodes' => $this->enableBBCodes,
+                               'enableHtml' => $this->enableHtml,
+                               'enableSmilies' => $this->enableSmilies,
+                               'showSignature' => $this->showSignature
                        )
                );
                if (!$this->draft) {
index 7067c9872b322eded7af7f36e751888d493ed9db..6ca185c78579678ef90d6e51da5aec0f6b60c060 100644 (file)
@@ -167,7 +167,11 @@ class ConversationMessageAddForm extends MessageForm {
                        'message' => $this->text,
                        'time' => TIME_NOW,
                        'userID' => WCF::getUser()->userID,
-                       'username' => WCF::getUser()->username
+                       'username' => WCF::getUser()->username,
+                       'enableBBCodes' => $this->enableBBCodes,
+                       'enableHtml' => $this->enableHtml,
+                       'enableSmilies' => $this->enableSmilies,
+                       'showSignature' => $this->showSignature
                );
                
                $messageData = array(
index b3dead29d2f56b72ce336e86fd84cdf448c49889..4c48d1e0a8435a2968792ad4292194111065d874 100644 (file)
@@ -120,7 +120,11 @@ class ConversationMessageEditForm extends ConversationAddForm {
                
                // save message
                $data = array(
-                       'message' => $this->text
+                       'message' => $this->text,
+                       'enableBBCodes' => $this->enableBBCodes,
+                       'enableHtml' => $this->enableHtml,
+                       'enableSmilies' => $this->enableSmilies,
+                       'showSignature' => $this->showSignature
                );
                $messageData = array(
                        'data' => $data,