@@ -287,7 +287,18 @@ public function addChangelogMessage(Room $chat, string $message): IComment {
287287 * @param string $referenceId
288288 * @return IComment
289289 */
290- public function sendMessage (Room $ chat , ?Participant $ participant , string $ actorType , string $ actorId , string $ message , \DateTime $ creationDateTime , ?IComment $ replyTo , string $ referenceId , bool $ silent ): IComment {
290+ public function sendMessage (
291+ Room $ chat ,
292+ ?Participant $ participant ,
293+ string $ actorType ,
294+ string $ actorId ,
295+ string $ message ,
296+ \DateTime $ creationDateTime ,
297+ ?IComment $ replyTo ,
298+ string $ referenceId ,
299+ bool $ silent ,
300+ bool $ forceLastMessageUpdate = false , // Remove when dropping commands
301+ ): IComment {
291302 $ comment = $ this ->commentsManager ->create ($ actorType , $ actorId , 'chat ' , (string ) $ chat ->getId ());
292303 $ comment ->setMessage ($ message , self ::MAX_CHAT_LENGTH );
293304 $ comment ->setCreationDateTime ($ creationDateTime );
@@ -322,9 +333,10 @@ public function sendMessage(Room $chat, ?Participant $participant, string $actor
322333 $ this ->participantService ->updateLastReadMessage ($ participant , (int ) $ comment ->getId ());
323334 }
324335
325- // Update last_message
336+ // Update last_message (not for commands)
326337 if ($ comment ->getActorType () !== Attendee::ACTOR_BOTS
327338 || $ comment ->getActorId () === Attendee::ACTOR_ID_CHANGELOG
339+ || $ forceLastMessageUpdate
328340 || str_starts_with ($ comment ->getActorId (), Attendee::ACTOR_BOT_PREFIX )) {
329341 $ this ->roomService ->setLastMessage ($ chat , $ comment );
330342 $ this ->unreadCountCache ->clear ($ chat ->getId () . '- ' );
0 commit comments