Browse Source

fix(participants): Don't throw an exception when inviting the same email twice

Signed-off-by: Joas Schilling <coding@schilljs.com>
pull/10694/head
Joas Schilling 2 years ago
parent
commit
51f713ea5e
No known key found for this signature in database GPG Key ID: 74434EFE0D2E2205
  1. 5
      lib/Controller/RoomController.php
  2. 3
      tests/integration/features/conversation/invite-email.feature

5
lib/Controller/RoomController.php

@ -1070,9 +1070,12 @@ class RoomController extends AEnvironmentAwareController {
$data = ['type' => $this->room->getType()]; $data = ['type' => $this->room->getType()];
} }
try {
$this->participantService->getParticipantByActor($this->room, Attendee::ACTOR_EMAILS, $newParticipant);
} catch (ParticipantNotFoundException) {
$participant = $this->participantService->inviteEmailAddress($this->room, $newParticipant); $participant = $this->participantService->inviteEmailAddress($this->room, $newParticipant);
$this->guestManager->sendEmailInvitation($this->room, $participant); $this->guestManager->sendEmailInvitation($this->room, $participant);
}
return new DataResponse($data); return new DataResponse($data);
} elseif ($source === 'remotes') { } elseif ($source === 'remotes') {

3
tests/integration/features/conversation/invite-email.feature

@ -7,6 +7,9 @@ Feature: conversation/invite-email)
| roomType | 3 | | roomType | 3 |
| roomName | room | | roomName | room |
When user "participant1" adds email "test@example.tld" to room "room" with 200 (v4) When user "participant1" adds email "test@example.tld" to room "room" with 200 (v4)
# Adding the same email again should not error to help the Calendar integration
# Ref https://github.com/nextcloud/calendar/pull/5380
When user "participant1" adds email "test@example.tld" to room "room" with 200 (v4)
Then user "participant1" sees the following attendees in room "room" with 200 (v4) Then user "participant1" sees the following attendees in room "room" with 200 (v4)
| participantType | inCall | actorType | actorId | | participantType | inCall | actorType | actorId |
| 4 | 0 | emails | test@example.tld | | 4 | 0 | emails | test@example.tld |

Loading…
Cancel
Save