Skip to content

Commit

Permalink
Reload the object so that hasEmbeddedObjects has the correct value …
Browse files Browse the repository at this point in the history
…when the notification is generated
  • Loading branch information
Cyperghost committed Sep 11, 2024
1 parent a9b7a3f commit 8f95030
Showing 1 changed file with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,20 +118,6 @@ public function create()
// 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
Expand Down Expand Up @@ -195,6 +181,20 @@ public function create()
}
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;
}
Expand Down

0 comments on commit 8f95030

Please sign in to comment.