Skip to content

Commit ac2fac9

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

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
@@ -1426,13 +1426,6 @@ public function addParticipantToRoom(string $newParticipant, string $source = 'u
14261426

14271427
$this->participantService->addCircle($this->room, $circle, $participants);
14281428
} elseif ($source === 'emails') {
1429-
$data = [];
1430-
try {
1431-
$this->roomService->setType($this->room, Room::TYPE_PUBLIC);
1432-
$data = ['type' => $this->room->getType()];
1433-
} catch (TypeException) {
1434-
}
1435-
14361429
$email = strtolower($newParticipant);
14371430
$actorId = hash('sha256', $email);
14381431
try {
@@ -1442,7 +1435,7 @@ public function addParticipantToRoom(string $newParticipant, string $source = 'u
14421435
$this->guestManager->sendEmailInvitation($this->room, $participant);
14431436
}
14441437

1445-
return new DataResponse($data);
1438+
return new DataResponse([]);
14461439
} elseif ($source === 'federated_users') {
14471440
if (!$this->talkConfig->isFederationEnabled()) {
14481441
return new DataResponse(['error' => 'federation'], Http::STATUS_NOT_IMPLEMENTED);

lib/Service/RoomService.php

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

690690
if ($oldType === Room::TYPE_PUBLIC) {
691-
// Kick all guests and users that were not invited
691+
// Kick all guests that are not email invited
692+
// and all users that joined the public link
692693
$delete = $this->db->getQueryBuilder();
693694
$delete->delete('talk_attendees')
694695
->where($delete->expr()->eq('room_id', $delete->createNamedParameter($room->getId(), IQueryBuilder::PARAM_INT)))
695-
->andWhere($delete->expr()->in('participant_type', $delete->createNamedParameter([Participant::GUEST, Participant::GUEST_MODERATOR, Participant::USER_SELF_JOINED], IQueryBuilder::PARAM_INT_ARRAY)));
696+
->andWhere($delete->expr()->in('participant_type', $delete->createNamedParameter([Participant::GUEST, Participant::GUEST_MODERATOR, Participant::USER_SELF_JOINED], IQueryBuilder::PARAM_INT_ARRAY)))
697+
->andWhere($delete->expr()->neq('actor_type', $delete->createNamedParameter(Attendee::ACTOR_EMAILS, IQueryBuilder::PARAM_INT)));
696698
$delete->executeStatement();
697699
}
698700

0 commit comments

Comments
 (0)