Skip to content

Commit eae90dd

Browse files
committed
feat(email): Allow inviting email guests to private conversations
Signed-off-by: Joas Schilling <coding@schilljs.com>
1 parent 644c3fa commit eae90dd

2 files changed

Lines changed: 5 additions & 10 deletions

File tree

lib/Controller/RoomController.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1197,13 +1197,6 @@ public function addParticipantToRoom(string $newParticipant, string $source = 'u
11971197

11981198
$this->participantService->addCircle($this->room, $circle, $participants);
11991199
} elseif ($source === 'emails') {
1200-
$data = [];
1201-
try {
1202-
$this->roomService->setType($this->room, Room::TYPE_PUBLIC);
1203-
$data = ['type' => $this->room->getType()];
1204-
} catch (TypeException) {
1205-
}
1206-
12071200
$email = $newParticipant;
12081201
$actorId = hash('sha256', $email);
12091202
try {
@@ -1213,7 +1206,7 @@ public function addParticipantToRoom(string $newParticipant, string $source = 'u
12131206
$this->guestManager->sendEmailInvitation($this->room, $participant);
12141207
}
12151208

1216-
return new DataResponse($data);
1209+
return new DataResponse([]);
12171210
} elseif ($source === 'federated_users') {
12181211
if (!$this->talkConfig->isFederationEnabled()) {
12191212
return new DataResponse([], Http::STATUS_NOT_IMPLEMENTED);

lib/Service/RoomService.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -531,11 +531,13 @@ public function setType(Room $room, int $newType, bool $allowSwitchingOneToOne =
531531
$room->setType($newType);
532532

533533
if ($oldType === Room::TYPE_PUBLIC) {
534-
// Kick all guests and users that were not invited
534+
// Kick all guests that are not email invited
535+
// and all users that joined the public link
535536
$delete = $this->db->getQueryBuilder();
536537
$delete->delete('talk_attendees')
537538
->where($delete->expr()->eq('room_id', $delete->createNamedParameter($room->getId(), IQueryBuilder::PARAM_INT)))
538-
->andWhere($delete->expr()->in('participant_type', $delete->createNamedParameter([Participant::GUEST, Participant::GUEST_MODERATOR, Participant::USER_SELF_JOINED], IQueryBuilder::PARAM_INT_ARRAY)));
539+
->andWhere($delete->expr()->in('participant_type', $delete->createNamedParameter([Participant::GUEST, Participant::GUEST_MODERATOR, Participant::USER_SELF_JOINED], IQueryBuilder::PARAM_INT_ARRAY)))
540+
->andWhere($delete->expr()->neq('actor_type', $delete->createNamedParameter(Attendee::ACTOR_EMAILS, IQueryBuilder::PARAM_INT)));
539541
$delete->executeStatement();
540542
}
541543

0 commit comments

Comments
 (0)