Skip to content

Commit

Permalink
feat(email): Allow inviting email guests to private conversations
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen committed Oct 23, 2024
1 parent 644c3fa commit eae90dd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
9 changes: 1 addition & 8 deletions lib/Controller/RoomController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1197,13 +1197,6 @@ public function addParticipantToRoom(string $newParticipant, string $source = 'u

$this->participantService->addCircle($this->room, $circle, $participants);
} elseif ($source === 'emails') {
$data = [];
try {
$this->roomService->setType($this->room, Room::TYPE_PUBLIC);
$data = ['type' => $this->room->getType()];
} catch (TypeException) {
}

$email = $newParticipant;
$actorId = hash('sha256', $email);
try {
Expand All @@ -1213,7 +1206,7 @@ public function addParticipantToRoom(string $newParticipant, string $source = 'u
$this->guestManager->sendEmailInvitation($this->room, $participant);
}

return new DataResponse($data);
return new DataResponse([]);
} elseif ($source === 'federated_users') {
if (!$this->talkConfig->isFederationEnabled()) {
return new DataResponse([], Http::STATUS_NOT_IMPLEMENTED);
Expand Down
6 changes: 4 additions & 2 deletions lib/Service/RoomService.php
Original file line number Diff line number Diff line change
Expand Up @@ -531,11 +531,13 @@ public function setType(Room $room, int $newType, bool $allowSwitchingOneToOne =
$room->setType($newType);

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

Expand Down

0 comments on commit eae90dd

Please sign in to comment.