Skip to content

Commit

Permalink
Document icon-url on call rich objects
Browse files Browse the repository at this point in the history
#8333 introduced an optional `icon-url`
for the call objects in rich messages.

#8389

Signed-off-by: Vitor Mattos <vitor@php.rio>
  • Loading branch information
vitormattos committed Mar 20, 2023
1 parent 0596c34 commit e254c80
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 35 deletions.
1 change: 1 addition & 0 deletions lib/Chat/Parser/UserMention.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ public function parseMessage(Message $chatMessage): void {
'id' => $chatMessage->getRoom()->getToken(),
'name' => $chatMessage->getRoom()->getDisplayName($userId),
'call-type' => $this->getRoomType($chatMessage->getRoom()),
'icon-url' => $chatMessage->getRoom()->getAvatar(),
];
} elseif ($mention['type'] === 'guest') {
try {
Expand Down
1 change: 1 addition & 0 deletions lib/Controller/ChatController.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ public function shareObjectToChat(string $objectType, string $objectId, string $
}
$data['type'] = $objectType;
$data['id'] = $objectId;
$data['icon-url'] = $this->room->getAvatar();

if (isset($data['link']) && !$this->trustedDomainHelper->isTrustedUrl($data['link'])) {
return new DataResponse([], Http::STATUS_BAD_REQUEST);
Expand Down
7 changes: 7 additions & 0 deletions lib/Notification/Notifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ protected function parseStoredRecordingFail(
'id' => $room->getId(),
'name' => $room->getDisplayName($participant->getAttendee()->getActorId()),
'call-type' => $this->getRoomType($room),
'icon-url' => $room->getAvatar(),
],
]
);
Expand Down Expand Up @@ -385,6 +386,7 @@ protected function parseStoredRecording(
'id' => $room->getId(),
'name' => $room->getDisplayName($participant->getAttendee()->getActorId()),
'call-type' => $this->getRoomType($room),
'icon-url' => $room->getAvatar(),
],
'file' => [
'type' => 'file',
Expand Down Expand Up @@ -481,6 +483,7 @@ protected function parseChatMessage(INotification $notification, Room $room, Par
'id' => $room->getId(),
'name' => $room->getDisplayName($notification->getUser()),
'call-type' => $this->getRoomType($room),
'icon-url' => $room->getAvatar(),
];

$messageParameters = $notification->getMessageParameters();
Expand Down Expand Up @@ -777,6 +780,7 @@ protected function parseInvitation(INotification $notification, Room $room, IL10
'id' => $room->getId(),
'name' => $roomName,
'call-type' => $this->getRoomType($room),
'icon-url' => $room->getAvatar(),
],
]
);
Expand All @@ -802,6 +806,7 @@ protected function parseInvitation(INotification $notification, Room $room, IL10
'id' => $room->getId(),
'name' => $roomName,
'call-type' => $this->getRoomType($room),
'icon-url' => $room->getAvatar(),
],
]
);
Expand Down Expand Up @@ -853,6 +858,7 @@ protected function parseCall(INotification $notification, Room $room, IL10N $l):
'id' => $room->getId(),
'name' => $roomName,
'call-type' => $this->getRoomType($room),
'icon-url' => $room->getAvatar(),
],
]
);
Expand All @@ -877,6 +883,7 @@ protected function parseCall(INotification $notification, Room $room, IL10N $l):
'id' => $room->getId(),
'name' => $roomName,
'call-type' => $this->getRoomType($room),
'icon-url' => $room->getAvatar(),
],
]
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Feature: chat-2/rich-object-share
When user "participant1" shares rich-object "call" "R4nd0mT0k3n" '{"name":"Another room","call-type":"group"}' to room "public room" with 201 (v1)
Then user "participant1" sees the following shared other in room "public room" with 200
| room | actorType | actorId | actorDisplayName | message | messageParameters |
| public room | users | participant1 | participant1-displayname | {object} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"object":{"name":"Another room","call-type":"group","type":"call","id":"R4nd0mT0k3n"}} |
| public room | users | participant1 | participant1-displayname | {object} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"object":{"name":"Another room","call-type":"group","type":"call","id":"R4nd0mT0k3n","icon-url":""}} |
When user "participant1" shares "welcome.txt" with room "public room" with OCS 100
Then user "participant1" sees the following shared file in room "public room" with 200
| room | actorType | actorId | actorDisplayName | message | messageParameters |
Expand Down
1 change: 1 addition & 0 deletions tests/php/Chat/Parser/UserMentionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ public function testGetRichMessageWithAtAll(): void {
'id' => 'token',
'name' => 'name',
'call-type' => 'group',
'icon-url' => '',
]
];

Expand Down
2 changes: 2 additions & 0 deletions tests/php/Controller/ChatControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,7 @@ public function testShareObjectToChatByUser() {
'call-type' => 'one2one',
'type' => 'call',
'id' => 'R4nd0mToken',
'icon-url' => '',
];

$date = new \DateTime();
Expand All @@ -659,6 +660,7 @@ public function testShareObjectToChatByUser() {
'call-type' => 'one2one',
'type' => 'call',
'id' => 'R4nd0mToken',
'icon-url' => '',
],
],
]),
Expand Down

0 comments on commit e254c80

Please sign in to comment.