From: Cyperghost Date: Wed, 11 Sep 2024 10:31:07 +0000 (+0200) Subject: Reload the object so that `hasEmbeddedObjects` has the correct value when the notific... X-Git-Tag: 6.1.0_Beta_2~1^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=8f95030fd7de5f25ece46796d634a1e1fe52e5cf;p=GitHub%2FWoltLab%2Fcom.woltlab.wcf.conversation.git Reload the object so that `hasEmbeddedObjects` has the correct value when the notification is generated --- diff --git a/files/lib/data/conversation/message/ConversationMessageAction.class.php b/files/lib/data/conversation/message/ConversationMessageAction.class.php index 9ea1de0..d95f48d 100644 --- a/files/lib/data/conversation/message/ConversationMessageAction.class.php +++ b/files/lib/data/conversation/message/ConversationMessageAction.class.php @@ -118,20 +118,6 @@ class ConversationMessageAction extends AbstractDatabaseObjectAction implements // update last message $conversationEditor->addMessage($message); - // fire notification event - if (!$conversation->isDraft) { - // don't notify message author - $notificationRecipients = \array_diff($conversation->getParticipantIDs(true), [$message->userID]); - if (!empty($notificationRecipients)) { - UserNotificationHandler::getInstance()->fireEvent( - 'conversationMessage', - 'com.woltlab.wcf.conversation.message.notification', - new ConversationMessageUserNotificationObject($message), - $notificationRecipients - ); - } - } - $userConversation = Conversation::getUserConversation($conversation->conversationID, $message->userID); if ($userConversation !== null && $userConversation->isInvisible) { // make invisible participant visible @@ -195,6 +181,20 @@ class ConversationMessageAction extends AbstractDatabaseObjectAction implements } MessageQuoteManager::getInstance()->removeMarkedQuotes(); + // fire notification event + if (empty($this->parameters['isFirstPost']) && !$conversation->isDraft) { + // don't notify message author + $notificationRecipients = \array_diff($conversation->getParticipantIDs(true), [$message->userID]); + if (!empty($notificationRecipients)) { + UserNotificationHandler::getInstance()->fireEvent( + 'conversationMessage', + 'com.woltlab.wcf.conversation.message.notification', + new ConversationMessageUserNotificationObject(new ConversationMessage($message->messageID)), + $notificationRecipients + ); + } + } + // return new message return $message; }