mirror of
https://github.com/nextcloud/spreed.git
synced 2025-12-17 21:12:20 +01:00
Merge pull request #14965 from nextcloud/fix/14935/scheduling-on-1-1-before-writing
fix(scheduling): Enforce one-to-one participants before scheduling
This commit is contained in:
commit
e3bee25561
5 changed files with 16 additions and 3 deletions
|
|
@ -621,6 +621,9 @@ class RoomController extends AEnvironmentAwareOCSController {
|
|||
try {
|
||||
$oldRoom = $this->manager->getRoomForUserByToken($objectId, $this->userId);
|
||||
} catch (RoomNotFoundException) {
|
||||
}
|
||||
|
||||
if ($oldRoom->getType() === Room::TYPE_ONE_TO_ONE_FORMER) {
|
||||
return new DataResponse(['error' => CreationException::REASON_OBJECT], Http::STATUS_BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
|
@ -2661,7 +2664,7 @@ class RoomController extends AEnvironmentAwareOCSController {
|
|||
* @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
|
||||
* @return DataResponse<Http::STATUS_OK, null, array{}>|DataResponse<Http::STATUS_BAD_REQUEST, array{error: 'calendar'|'email'|'end'|'start'}, array{}>
|
||||
* @return DataResponse<Http::STATUS_OK, null, array{}>|DataResponse<Http::STATUS_BAD_REQUEST, array{error: 'calendar'|'conversation'|'email'|'end'|'start'}, array{}>
|
||||
*
|
||||
* 200: Meeting scheduled
|
||||
* 400: Meeting could not be created successfully
|
||||
|
|
@ -2669,6 +2672,10 @@ class RoomController extends AEnvironmentAwareOCSController {
|
|||
#[NoAdminRequired]
|
||||
#[RequireLoggedInModeratorParticipant]
|
||||
public function scheduleMeeting(string $calendarUri, int $start, ?array $attendeeIds = null, ?int $end = null, ?string $title = null, ?string $description = null): DataResponse {
|
||||
if ($this->room->getType() === Room::TYPE_ONE_TO_ONE_FORMER) {
|
||||
return new DataResponse(['error' => 'conversation'], Http::STATUS_BAD_REQUEST);
|
||||
}
|
||||
|
||||
$eventBuilder = $this->calendarManager->createEventBuilder();
|
||||
$calendars = $this->calendarManager->getCalendarsForPrincipal('principals/users/' . $this->userId, [$calendarUri]);
|
||||
|
||||
|
|
@ -2712,6 +2719,10 @@ class RoomController extends AEnvironmentAwareOCSController {
|
|||
$eventBuilder->setEndDate($endDate);
|
||||
$eventBuilder->setStatus(CalendarEventStatus::CONFIRMED);
|
||||
|
||||
if ($this->room->getType() === Room::TYPE_ONE_TO_ONE) {
|
||||
$this->participantService->ensureOneToOneRoomIsFilled($this->room);
|
||||
}
|
||||
|
||||
$userAttendees = $this->participantService->getParticipantsByActorType($this->room, Attendee::ACTOR_USERS);
|
||||
foreach ($userAttendees as $userAttendee) {
|
||||
if ($attendeeIds !== null && !in_array($userAttendee->getAttendee()->getId(), $attendeeIds, true)) {
|
||||
|
|
|
|||
|
|
@ -18675,6 +18675,7 @@
|
|||
"type": "string",
|
||||
"enum": [
|
||||
"calendar",
|
||||
"conversation",
|
||||
"email",
|
||||
"end",
|
||||
"start"
|
||||
|
|
|
|||
|
|
@ -18580,6 +18580,7 @@
|
|||
"type": "string",
|
||||
"enum": [
|
||||
"calendar",
|
||||
"conversation",
|
||||
"email",
|
||||
"end",
|
||||
"start"
|
||||
|
|
|
|||
|
|
@ -9170,7 +9170,7 @@ export interface operations {
|
|||
meta: components["schemas"]["OCSMeta"];
|
||||
data: {
|
||||
/** @enum {string} */
|
||||
error: "calendar" | "email" | "end" | "start";
|
||||
error: "calendar" | "conversation" | "email" | "end" | "start";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -8652,7 +8652,7 @@ export interface operations {
|
|||
meta: components["schemas"]["OCSMeta"];
|
||||
data: {
|
||||
/** @enum {string} */
|
||||
error: "calendar" | "email" | "end" | "start";
|
||||
error: "calendar" | "conversation" | "email" | "end" | "start";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue