Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/Signaling/Listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,7 @@ protected function notifyMessageSent(AMessageSentEvent $event): void {
$thread = null;
}
$data['chat']['comment'] = $message->toArray('json', $thread);
$data['chat']['comment']['lastCommonRead'] = $this->participantService->getLastCommonReadChatMessage($room);

$parent = $event->getParent();
if ($parent !== null) {
Expand Down Expand Up @@ -593,6 +594,7 @@ protected function notifySystemMessageSent(ASystemMessageSentEvent $event): void
}

$data['chat']['comment'] = $message->toArray('json', $thread);
$data['chat']['comment']['lastCommonRead'] = $this->participantService->getLastCommonReadChatMessage($room);

if ($messageType === 'call_started') {
$metaData = $comment->getMetaData() ?? [];
Expand Down Expand Up @@ -701,6 +703,7 @@ protected function notifyReactionSent(AReactionEvent $event): void {
'markdown' => false ,
'expirationTimestamp' => $message->getExpirationDateTime()?->getTimestamp() ?? 0,
'threadId' => $threadId,
'lastCommonRead' => $this->participantService->getLastCommonReadChatMessage($room),
];

$data['chat']['comment']['parent'] = $message->toArray('json', $thread);
Expand Down
18 changes: 14 additions & 4 deletions tests/php/Signaling/ListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,9 @@ public function testChatMessageSentEvent(): void {
$comment->method('getId')->willReturn(1);
$message = $this->createConfiguredMock(Message::class, [
'getVisibility' => true,
'toArray' => [],
'toArray' => [
'id' => 123,
],
'getMessageId' => 123,
]);
$l10n = $this->createMock(IL10N::class);
Expand All @@ -317,7 +319,10 @@ public function testChatMessageSentEvent(): void {
'type' => 'chat',
'chat' => [
'refresh' => true,
'comment' => [],
'comment' => [
'id' => 123,
'lastCommonRead' => 0,
],
],
]);

Expand All @@ -333,7 +338,9 @@ public function testChatMessageSentWithThreadEvent(): void {
$comment->method('getId')->willReturn(1);
$message = $this->createConfiguredMock(Message::class, [
'getVisibility' => true,
'toArray' => [],
'toArray' => [
'id' => 123,
],
'getMessageId' => 123,
]);

Expand Down Expand Up @@ -365,7 +372,10 @@ public function testChatMessageSentWithThreadEvent(): void {
'type' => 'chat',
'chat' => [
'refresh' => true,
'comment' => [],
'comment' => [
'id' => 123,
'lastCommonRead' => 0,
],
],
]);

Expand Down
Loading