Fixed multiple issues
authorMarcel Werk <burntime@woltlab.com>
Sun, 21 Apr 2013 16:58:53 +0000 (18:58 +0200)
committerMarcel Werk <burntime@woltlab.com>
Sun, 21 Apr 2013 16:58:53 +0000 (18:58 +0200)
files/lib/data/conversation/ConversationEditor.class.php
files/lib/data/conversation/message/ConversationMessageAction.class.php

index 2ab2c0571c06c5de92bbe6eea92f4064ac85a952..4f96ad1b2c8b7e631edfa40823d0717bf5fb5a2a 100644 (file)
@@ -97,12 +97,14 @@ class ConversationEditor extends DatabaseObjectEditor {
                                        WHERE   conversation_to_user.conversationID = conversation.conversationID
                                                AND conversation_to_user.hideConversation <> ?
                                                AND conversation_to_user.participantID <> ?
+                                               AND conversation_to_user.isInvisible = ?
                                )
                        WHERE   conversation.conversationID = ?";
                $statement = WCF::getDB()->prepareStatement($sql);
                $statement->execute(array(
                        Conversation::STATE_LEFT,
                        $this->userID,
+                       0,
                        $this->conversationID
                ));
        }
index 9597bd9604b1ae885f81612db10a279195df0b17..69dd90b11e76b702ee365fa53cce5aca61b1827f 100644 (file)
@@ -94,13 +94,19 @@ class ConversationMessageAction extends AbstractDatabaseObjectAction implements
                                }
                        }
                        
-                       // make invisible participant visible
-                       $sql = "UPDATE  wcf".WCF_N."_conversation_to_user
-                               SET     isInvisible = 0
-                               WHERE   participantID = ?
-                                       AND conversationID = ?";
-                       $statement = WCF::getDB()->prepareStatement($sql);
-                       $statement->execute(array($message->userID, $conversation->conversationID));
+                       $userConversation = Conversation::getUserConversation($conversation->conversationID, $message->userID);
+                       if ($userConversation !== null && $userConversation->isInvisible) {
+                               // make invisible participant visible
+                               $sql = "UPDATE  wcf".WCF_N."_conversation_to_user
+                                       SET     isInvisible = 0
+                                       WHERE   participantID = ?
+                                               AND conversationID = ?";
+                               $statement = WCF::getDB()->prepareStatement($sql);
+                               $statement->execute(array($message->userID, $conversation->conversationID));
+                               
+                               $conversationEditor->updateParticipantSummary();
+                               $conversationEditor->updateParticipantCount();
+                       }
                        
                        // reset visibility if it was hidden but not left
                        $sql = "UPDATE  wcf".WCF_N."_conversation_to_user