Skip to content

Commit

Permalink
Merge pull request #10694 from nextcloud/bugfix/noid/duplicate-email-…
Browse files Browse the repository at this point in the history
…exception

fix(participants): Don't throw an exception when inviting the same em…
  • Loading branch information
nickvergessen authored Oct 13, 2023
2 parents c1472ed + 51f713e commit 670f924
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/Controller/RoomController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1070,9 +1070,12 @@ public function addParticipantToRoom(string $newParticipant, string $source = 'u
$data = ['type' => $this->room->getType()];
}

$participant = $this->participantService->inviteEmailAddress($this->room, $newParticipant);

$this->guestManager->sendEmailInvitation($this->room, $participant);
try {
$this->participantService->getParticipantByActor($this->room, Attendee::ACTOR_EMAILS, $newParticipant);
} catch (ParticipantNotFoundException) {
$participant = $this->participantService->inviteEmailAddress($this->room, $newParticipant);
$this->guestManager->sendEmailInvitation($this->room, $participant);
}

return new DataResponse($data);
} elseif ($source === 'remotes') {
Expand Down
3 changes: 3 additions & 0 deletions tests/integration/features/conversation/invite-email.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ Feature: conversation/invite-email)
| roomType | 3 |
| roomName | room |
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)
| participantType | inCall | actorType | actorId |
| 4 | 0 | emails | test@example.tld |
Expand Down

0 comments on commit 670f924

Please sign in to comment.