Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(meeting): Allow to give a list of attendee ids to invite #14096

Merged
merged 2 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions lib/Controller/RoomController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2578,6 +2578,7 @@ public function getCapabilities(): DataResponse {
*
* @param string $calendarUri Last part of the calendar URI as seen by the participant e.g. 'personal' or 'company_shared_by_other_user'
* @param int $start Unix timestamp when the meeting starts
* @param ?list<int> $attendeeIds List of attendee ids to invite, if null everyone will be invited, if empty array only the actor will receive the event
* @param ?int $end Unix timestamp when the meeting ends, falls back to 60 minutes after start
* @param ?string $title Title or summary of the event, falling back to the conversation name if none is given
* @param ?string $description Description of the event, falling back to the conversation description if none is given
Expand All @@ -2588,7 +2589,7 @@ public function getCapabilities(): DataResponse {
*/
#[NoAdminRequired]
#[RequireLoggedInModeratorParticipant]
public function scheduleMeeting(string $calendarUri, int $start, ?int $end = null, ?string $title = null, ?string $description = null): DataResponse {
public function scheduleMeeting(string $calendarUri, int $start, ?array $attendeeIds = null, ?int $end = null, ?string $title = null, ?string $description = null): DataResponse {
$eventBuilder = $this->calendarManager->createEventBuilder();
$calendars = $this->calendarManager->getCalendarsForPrincipal('principals/users/' . $this->userId, [$calendarUri]);

Expand Down Expand Up @@ -2631,9 +2632,13 @@ public function scheduleMeeting(string $calendarUri, int $start, ?int $end = nul
$eventBuilder->setStartDate($startDate);
$eventBuilder->setEndDate($endDate);

$userIds = $this->participantService->getParticipantUserIds($this->room);
foreach ($userIds as $userId) {
$targetUser = $this->userManager->get($userId);
$userAttendees = $this->participantService->getParticipantsByActorType($this->room, Attendee::ACTOR_USERS);
foreach ($userAttendees as $userAttendee) {
if ($attendeeIds !== null && !in_array($userAttendee->getAttendee()->getId(), $attendeeIds, true)) {
continue;
}

$targetUser = $this->userManager->get($userAttendee->getAttendee()->getActorId());
if (!$targetUser instanceof IUser) {
continue;
}
Expand All @@ -2649,6 +2654,10 @@ public function scheduleMeeting(string $calendarUri, int $start, ?int $end = nul

$emailGuests = $this->participantService->getParticipantsByActorType($this->room, Attendee::ACTOR_EMAILS);
foreach ($emailGuests as $emailGuest) {
if ($attendeeIds !== null && !in_array($emailGuest->getAttendee()->getId(), $attendeeIds, true)) {
continue;
}

$eventBuilder->addAttendee(
$emailGuest->getAttendee()->getInvitedCloudId(),
$emailGuest->getAttendee()->getDisplayName(),
Expand Down
9 changes: 9 additions & 0 deletions openapi-full.json
Original file line number Diff line number Diff line change
Expand Up @@ -17561,6 +17561,15 @@
"format": "int64",
"description": "Unix timestamp when the meeting starts"
},
"attendeeIds": {
"type": "array",
"nullable": true,
"description": "List of attendee ids to invite, if null everyone will be invited, if empty array only the actor will receive the event",
"items": {
"type": "integer",
"format": "int64"
}
},
"end": {
"type": "integer",
"format": "int64",
Expand Down
9 changes: 9 additions & 0 deletions openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -17719,6 +17719,15 @@
"format": "int64",
"description": "Unix timestamp when the meeting starts"
},
"attendeeIds": {
"type": "array",
"nullable": true,
"description": "List of attendee ids to invite, if null everyone will be invited, if empty array only the actor will receive the event",
"items": {
"type": "integer",
"format": "int64"
}
},
"end": {
"type": "integer",
"format": "int64",
Expand Down
2 changes: 2 additions & 0 deletions src/types/openapi/openapi-full.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8704,6 +8704,8 @@ export interface operations {
* @description Unix timestamp when the meeting starts
*/
start: number;
/** @description List of attendee ids to invite, if null everyone will be invited, if empty array only the actor will receive the event */
attendeeIds?: number[] | null;
/**
* Format: int64
* @description Unix timestamp when the meeting ends, falls back to 60 minutes after start
Expand Down
2 changes: 2 additions & 0 deletions src/types/openapi/openapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8288,6 +8288,8 @@ export interface operations {
* @description Unix timestamp when the meeting starts
*/
start: number;
/** @description List of attendee ids to invite, if null everyone will be invited, if empty array only the actor will receive the event */
attendeeIds?: number[] | null;
/**
* Format: int64
* @description Unix timestamp when the meeting ends, falls back to 60 minutes after start
Expand Down
Loading