Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 5dcc8055 authored by Christoph Wurst's avatar Christoph Wurst
Browse files

fixup! Create Talk rooms for appointments

parent 9bfb5dee
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@
* ☑️ Tasks! See tasks with a due date directly in the calendar
* 🙈 **We’re not reinventing the wheel!** Based on the great [c-dav library](https://github.com/nextcloud/cdav-library), [ical.js](https://github.com/mozilla-comm/ical.js) and [fullcalendar](https://github.com/fullcalendar/fullcalendar) libraries.
	]]></description>
	<version>3.2.0</version>
	<version>3.3.0-alpha.1</version>
	<licence>agpl</licence>
	<author>Anna Larch</author>
	<author homepage="https://github.com/nextcloud/groupware">Nextcloud Groupware Team</author>
+3 −0
Original line number Diff line number Diff line
@@ -24,6 +24,8 @@ declare(strict_types=1);
namespace OCA\Calendar\AppInfo;

use OCA\Calendar\Dashboard\CalendarWidget;
use OCA\Calendar\Events\AppointmentBookedEvent;
use OCA\Calendar\Listener\AppointmentBookedListener;
use OCA\Calendar\Listener\UserDeletedListener;
use OCA\Calendar\Profile\AppointmentsAction;
use OCP\AppFramework\App;
@@ -56,6 +58,7 @@ class Application extends App implements IBootstrap {
			$context->registerProfileLinkAction(AppointmentsAction::class);
		}

		$context->registerEventListener(AppointmentBookedEvent::class, AppointmentBookedListener::class);
		$context->registerEventListener(UserDeletedEvent::class, UserDeletedListener::class);
	}

+3 −1
Original line number Diff line number Diff line
@@ -194,7 +194,8 @@ class AppointmentConfigController extends Controller {
				$calendarFreeBusyUris,
				$start,
				$end,
				$futureLimit
				$futureLimit,
				$createTalkRoom
			);
			return JsonResponse::success($appointmentConfig);
		} catch (ServiceException $e) {
@@ -277,6 +278,7 @@ class AppointmentConfigController extends Controller {
		$appointmentConfig->setStart($start);
		$appointmentConfig->setEnd($end);
		$appointmentConfig->setFutureLimit($futureLimit);
		$appointmentConfig->setCreateTalkRoom($createTalkRoom === true);

		try {
			$appointmentConfig = $this->appointmentConfigService->update($appointmentConfig);
+7 −1
Original line number Diff line number Diff line
@@ -70,6 +70,8 @@ use function json_encode;
 * @method void setDailyMax(?int $max)
 * @method int|null getFutureLimit()
 * @method void setFutureLimit(?int $limit)
 * @method int|null getCreateTalkRoom()
 * @method void setCreateTalkRoom(bool $create)
 */
class AppointmentConfig extends Entity implements JsonSerializable {

@@ -127,6 +129,9 @@ class AppointmentConfig extends Entity implements JsonSerializable {
	/** @var int|null */
	protected $futureLimit;

	/** @var bool */
	protected $createTalkRoom;

	/** @var string */
	public const VISIBILITY_PUBLIC = 'PUBLIC';

@@ -143,6 +148,7 @@ class AppointmentConfig extends Entity implements JsonSerializable {
		$this->addType('timeBeforeNextSlot', 'int');
		$this->addType('dailyMax', 'int');
		$this->addType('futureLimit', 'int');
		$this->addType('createTalkRoom', 'boolean');
	}

	/**
@@ -205,7 +211,7 @@ class AppointmentConfig extends Entity implements JsonSerializable {
			'timeBeforeNextSlot' => $this->getTimeBeforeNextSlot(),
			'dailyMax' => $this->getDailyMax(),
			'futureLimit' => $this->getFutureLimit(),
			'createTalkRoom' => false,
			'createTalkRoom' => $this->getCreateTalkRoom(),
		];
	}
}
+54 −0
Original line number Diff line number Diff line
<?php

declare(strict_types=1);

/*
 * @copyright 2022 Christoph Wurst <christoph@winzerhof-wurst.at>
 *
 * @author 2022 Christoph Wurst <christoph@winzerhof-wurst.at>
 *
 * @license GNU AGPL version 3 or any later version
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

namespace OCA\Calendar\Events;

use OCA\Calendar\Db\AppointmentConfig;
use OCA\Calendar\Db\Booking;
use OCP\EventDispatcher\Event;

class AppointmentBookedEvent extends Event {

	/** @var Booking */
	private $booking;
	/** @var AppointmentConfig */

	private $config;

	public function __construct(Booking $booking, AppointmentConfig $config) {
		parent::__construct();

		$this->booking = $booking;
		$this->config = $config;
	}

	public function getBooking(): Booking {
		return $this->booking;
	}

	public function getConfig(): AppointmentConfig {
		return $this->config;
	}
}
Loading