Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Return avatar id and version with the rest of the conversation data
Signed-off-by: Daniel Calviño Sánchez <[email protected]>
  • Loading branch information
danxuliu committed Dec 31, 2020
commit 760e6a57cb456c93d483c315bd5c87d1222b4625
2 changes: 2 additions & 0 deletions docs/conversation.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
`name` | string | * | Name of the conversation (can also be empty)
`displayName` | string | * | `name` if non empty, otherwise it falls back to a list of participants
`description` | string | v3 | Description of the conversation (can also be empty)
`avatarId` | string | v3 | The type of the avatar ("custom", "user", "icon-public", "icon-contacts", "icon-mail", "icon-password", "icon-changelog", "icon-file")
`avatarVersion` | int | v3 | The version of the avatar
`participantType` | int | * | Permissions level of the current user
`attendeeId` | int | v3 | Unique attendee id
`attendeePin` | string | v3 | Unique dial-in authentication code for this user, when the conversation has SIP enabled (see `sipEnabled` attribute)
Expand Down
4 changes: 4 additions & 0 deletions lib/Controller/RoomController.php
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,8 @@ protected function formatRoomV2andV3(Room $room, ?Participant $currentParticipan
'canEnableSIP' => false,
'attendeePin' => '',
'description' => '',
'avatarId' => '',
'avatarVersion' => 0,
'lastCommonReadMessage' => 0,
'listable' => Room::LISTABLE_NONE,
]);
Expand Down Expand Up @@ -658,6 +660,8 @@ protected function formatRoomV2andV3(Room $room, ?Participant $currentParticipan
'actorId' => $attendee->getActorId(),
'attendeeId' => $attendee->getId(),
'description' => $room->getDescription(),
'avatarId' => $room->getAvatarId(),
'avatarVersion' => $room->getAvatarVersion(),
'listable' => $room->getListable(),
]);

Expand Down
6 changes: 6 additions & 0 deletions tests/integration/features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,12 @@ private function assertRooms($rooms, TableNode $formData) {
if (isset($expectedRoom['description'])) {
$data['description'] = $room['description'];
}
if (isset($expectedRoom['avatarId'])) {
$data['avatarId'] = $room['avatarId'];
}
if (isset($expectedRoom['avatarVersion'])) {
$data['avatarVersion'] = $room['avatarVersion'];
}
if (isset($expectedRoom['type'])) {
$data['type'] = (string) $room['type'];
}
Expand Down
71 changes: 71 additions & 0 deletions tests/integration/features/conversation/avatar.feature
Original file line number Diff line number Diff line change
Expand Up @@ -460,3 +460,74 @@ Feature: avatar
And user "owner" sets avatar for room "group room" from file "data/green-square-256.png"
When user "owner" gets avatar for room "group room" with size "128"
Then last avatar is a custom avatar of size "128" and color "#00FF00"



Scenario: room list returns the default avatar after room creation
When user "owner" creates room "public room"
| roomType | 3 |
| roomName | room |
And user "owner" adds "moderator" to room "public room" with 200
And user "owner" promotes "moderator" in room "public room" with 200
And user "owner" adds "invited user" to room "public room" with 200
And user "not invited but joined user" joins room "public room" with 200
Then user "owner" is participant of the following rooms (v3)
| avatarId | avatarVersion |
| icon-public | 1 |
And user "moderator" is participant of the following rooms (v3)
| avatarId | avatarVersion |
| icon-public | 1 |
And user "invited user" is participant of the following rooms (v3)
| avatarId | avatarVersion |
| icon-public | 1 |
And user "not invited but joined user" is participant of the following rooms (v3)
| avatarId | avatarVersion |
| icon-public | 1 |

Scenario: room list returns a custom avatar after avatar is set
Given user "owner" creates room "public room"
| roomType | 3 |
| roomName | room |
And user "owner" adds "moderator" to room "public room" with 200
And user "owner" promotes "moderator" in room "public room" with 200
And user "owner" adds "invited user" to room "public room" with 200
And user "not invited but joined user" joins room "public room" with 200
When user "owner" sets avatar for room "public room" from file "data/green-square-256.png"
Then user "owner" is participant of the following rooms (v3)
| avatarId | avatarVersion |
| custom | 2 |
And user "moderator" is participant of the following rooms (v3)
| avatarId | avatarVersion |
| custom | 2 |
And user "invited user" is participant of the following rooms (v3)
| avatarId | avatarVersion |
| custom | 2 |
And user "not invited but joined user" is participant of the following rooms (v3)
| avatarId | avatarVersion |
| custom | 2 |

Scenario: room list returns a default avatar after avatar is deleted
Given user "owner" creates room "public room"
| roomType | 3 |
| roomName | room |
And user "owner" adds "moderator" to room "public room" with 200
And user "owner" promotes "moderator" in room "public room" with 200
And user "owner" adds "invited user" to room "public room" with 200
And user "not invited but joined user" joins room "public room" with 200
And user "owner" sets avatar for room "public room" from file "data/green-square-256.png"
And user "owner" is participant of the following rooms (v3)
| avatarId | avatarVersion |
| custom | 2 |
When user "owner" deletes avatar for room "public room"
Then user "owner" is participant of the following rooms (v3)
| avatarId | avatarVersion |
| icon-public | 3 |
And user "moderator" is participant of the following rooms (v3)
| avatarId | avatarVersion |
| icon-public | 3 |
And user "invited user" is participant of the following rooms (v3)
| avatarId | avatarVersion |
| icon-public | 3 |
And user "not invited but joined user" is participant of the following rooms (v3)
| avatarId | avatarVersion |
| icon-public | 3 |