diff --git a/lib/Controller/RoomController.php b/lib/Controller/RoomController.php index acb9a5fda0a..c9633603d9e 100644 --- a/lib/Controller/RoomController.php +++ b/lib/Controller/RoomController.php @@ -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') { diff --git a/tests/integration/features/conversation/invite-email.feature b/tests/integration/features/conversation/invite-email.feature index 415ff4054d8..441681d96aa 100644 --- a/tests/integration/features/conversation/invite-email.feature +++ b/tests/integration/features/conversation/invite-email.feature @@ -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 |