Skip to content

Commit

Permalink
Merge pull request #14096 from nextcloud/feat/6292/list-of-attendees
Browse files Browse the repository at this point in the history
feat(meeting): Allow to give a list of attendee ids to invite
  • Loading branch information
nickvergessen authored Jan 10, 2025
2 parents 5017117 + 1b77ec6 commit ad64951
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 4 deletions.
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

0 comments on commit ad64951

Please sign in to comment.