зеркало из https://github.com/nextcloud/spreed.git
Do not show room names when the user is not part of it
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Родитель
ae6c1fcc67
Коммит
89495851fc
|
@ -91,25 +91,32 @@ class ShareAPIController {
|
|||
return $result;
|
||||
}
|
||||
|
||||
// The display name of one-to-one rooms is set to the display name of
|
||||
// the other participant, except on reshares to rooms that the user is
|
||||
// not invited to, in which case the display name of both participants
|
||||
// is used.
|
||||
$roomName = $room->getName();
|
||||
if ($room->getType() === Room::ONE_TO_ONE_CALL) {
|
||||
$userIds = $room->getParticipantUserIds();
|
||||
foreach ($userIds as $userId) {
|
||||
if ($this->userId !== $userId) {
|
||||
try {
|
||||
$room->getParticipant($this->userId);
|
||||
|
||||
if ($room->getType() === Room::ONE_TO_ONE_CALL) {
|
||||
$userIds = $room->getParticipantUserIds();
|
||||
foreach ($userIds as $userId) {
|
||||
if ($this->userId === $userId) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$user = $this->userManager->get($userId);
|
||||
if ($user instanceof IUser) {
|
||||
$roomName = $roomName? $roomName . $this->l->t(', ') . $user->getDisplayName(): $user->getDisplayName();
|
||||
$roomName = $user->getDisplayName();
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if ($roomName === '') {
|
||||
$roomName = $this->l->t('Unnamed conversation');
|
||||
}
|
||||
} catch (ParticipantNotFoundException $e) {
|
||||
// Do not leak the name of rooms the user is not a part of
|
||||
$roomName = $this->l->t('Private conversation');
|
||||
}
|
||||
|
||||
$result['share_with_displayname'] = $roomName;
|
||||
|
||||
if ($room->getType() === Room::PUBLIC_CALL) {
|
||||
$result['token'] = $share->getToken();
|
||||
}
|
||||
|
|
|
@ -320,7 +320,7 @@ Feature: get
|
|||
| storage_id | home::participant1 |
|
||||
| file_target | /welcome (2).txt |
|
||||
| share_with | one-to-one room not invited to |
|
||||
| share_with_displayname | participant3-displayname, participant4-displayname |
|
||||
| share_with_displayname | Private conversation|
|
||||
|
||||
Scenario: get all shares and reshares of a user who reshared a file to an owned one-to-one room
|
||||
Given user "participant2" creates room "one-to-one room not invited to"
|
||||
|
@ -354,7 +354,7 @@ Feature: get
|
|||
| storage_id | home::participant1 |
|
||||
| file_target | /welcome (2).txt |
|
||||
| share_with | one-to-one room not invited to |
|
||||
| share_with_displayname | participant2-displayname, participant3-displayname |
|
||||
| share_with_displayname | Private conversation |
|
||||
|
||||
Scenario: get all shares and reshares of a user who reshared a file to a one-to-one room
|
||||
Given user "participant2" creates room "one-to-one room not invited to"
|
||||
|
@ -388,7 +388,7 @@ Feature: get
|
|||
| storage_id | home::participant1 |
|
||||
| file_target | /welcome (2).txt |
|
||||
| share_with | one-to-one room not invited to |
|
||||
| share_with_displayname | participant2-displayname, participant3-displayname |
|
||||
| share_with_displayname | Private conversation |
|
||||
|
||||
Scenario: get all shares of a file
|
||||
Given user "participant1" creates room "own group room"
|
||||
|
@ -527,7 +527,7 @@ Feature: get
|
|||
| storage_id | home::participant1 |
|
||||
| file_target | /welcome (2).txt |
|
||||
| share_with | one-to-one room not invited to |
|
||||
| share_with_displayname | participant3-displayname, participant4-displayname |
|
||||
| share_with_displayname | Private conversation |
|
||||
|
||||
Scenario: get all shares and reshares of a file reshared to a one-to-one room by its owner
|
||||
Given user "participant2" creates room "one-to-one room not invited to"
|
||||
|
@ -561,7 +561,7 @@ Feature: get
|
|||
| storage_id | home::participant1 |
|
||||
| file_target | /welcome (2).txt |
|
||||
| share_with | one-to-one room not invited to |
|
||||
| share_with_displayname | participant2-displayname, participant3-displayname |
|
||||
| share_with_displayname | Private conversation |
|
||||
|
||||
Scenario: get all shares and reshares of a file reshared to a one-to-one room by its second participant
|
||||
Given user "participant2" creates room "one-to-one room not invited to"
|
||||
|
@ -595,7 +595,7 @@ Feature: get
|
|||
| storage_id | home::participant1 |
|
||||
| file_target | /welcome (2).txt |
|
||||
| share_with | one-to-one room not invited to |
|
||||
| share_with_displayname | participant2-displayname, participant3-displayname |
|
||||
| share_with_displayname | Private conversation |
|
||||
|
||||
Scenario: get all shares and reshares of a deleted file
|
||||
Given user "participant1" creates room "own group room"
|
||||
|
|
Загрузка…
Ссылка в новой задаче