From 2a713e6b5afd5e873223b8242d074113dc62a86e Mon Sep 17 00:00:00 2001 From: Anna Larch Date: Tue, 13 Dec 2022 22:04:44 +0100 Subject: [PATCH] Remove comment and guests option from Invitations UI Signed-off-by: Anna Larch --- .../InvitationResponseController.php | 19 ++----------------- .../templates/schedule-response-options.php | 4 ---- .../InvitationResponseControllerTest.php | 14 ++------------ 3 files changed, 4 insertions(+), 33 deletions(-) diff --git a/apps/dav/lib/Controller/InvitationResponseController.php b/apps/dav/lib/Controller/InvitationResponseController.php index de22e3ba6a9e6..a360794987413 100644 --- a/apps/dav/lib/Controller/InvitationResponseController.php +++ b/apps/dav/lib/Controller/InvitationResponseController.php @@ -140,15 +140,13 @@ public function options(string $token):TemplateResponse { */ public function processMoreOptionsResult(string $token):TemplateResponse { $partstat = $this->request->getParam('partStat'); - $guests = (int) $this->request->getParam('guests'); - $comment = $this->request->getParam('comment'); $row = $this->getTokenInformation($token); if (!$row || !\in_array($partstat, ['ACCEPTED', 'DECLINED', 'TENTATIVE'])) { return new TemplateResponse($this->appName, 'schedule-response-error', [], 'guest'); } - $iTipMessage = $this->buildITipResponse($row, $partstat, $guests, $comment); + $iTipMessage = $this->buildITipResponse($row, $partstat); $this->responseServer->handleITipMessage($iTipMessage); if ($iTipMessage->getScheduleStatus() === '1.2') { return new TemplateResponse($this->appName, 'schedule-response-success', [], 'guest'); @@ -190,8 +188,7 @@ private function getTokenInformation(string $token) { * @param string|null $comment * @return Message */ - private function buildITipResponse(array $row, string $partStat, int $guests = null, - string $comment = null):Message { + private function buildITipResponse(array $row, string $partStat):Message { $iTipMessage = new Message(); $iTipMessage->uid = $row['uid']; $iTipMessage->component = 'VEVENT'; @@ -225,19 +222,7 @@ private function buildITipResponse(array $row, string $partStat, int $guests = n $row['uid'], $row['sequence'] ?? 0, $row['recurrenceid'] ?? '' ])); $vEvent = $vObject->{'VEVENT'}; - /** @var \Sabre\VObject\Property\ICalendar\CalAddress $attendee */ - $attendee = $vEvent->{'ATTENDEE'}; - $vEvent->DTSTAMP = date('Ymd\\THis\\Z', $this->timeFactory->getTime()); - - if ($comment) { - $attendee->add('X-RESPONSE-COMMENT', $comment); - $vEvent->add('COMMENT', $comment); - } - if ($guests) { - $attendee->add('X-NUM-GUESTS', $guests); - } - $iTipMessage->message = $vObject; return $iTipMessage; diff --git a/apps/dav/templates/schedule-response-options.php b/apps/dav/templates/schedule-response-options.php index f5ebb46cb2614..07757e001d268 100644 --- a/apps/dav/templates/schedule-response-options.php +++ b/apps/dav/templates/schedule-response-options.php @@ -23,10 +23,6 @@ -
- - -
diff --git a/apps/dav/tests/unit/Controller/InvitationResponseControllerTest.php b/apps/dav/tests/unit/Controller/InvitationResponseControllerTest.php index cd3269d657c9c..afbed93751087 100644 --- a/apps/dav/tests/unit/Controller/InvitationResponseControllerTest.php +++ b/apps/dav/tests/unit/Controller/InvitationResponseControllerTest.php @@ -380,18 +380,10 @@ public function testOptions() { * @dataProvider attendeeProvider */ public function testProcessMoreOptionsResult(bool $isExternalAttendee): void { - $this->request->expects($this->at(0)) + $this->request->expects($this->once()) ->method('getParam') ->with('partStat') ->willReturn('TENTATIVE'); - $this->request->expects($this->at(1)) - ->method('getParam') - ->with('guests') - ->willReturn('7'); - $this->request->expects($this->at(2)) - ->method('getParam') - ->with('comment') - ->willReturn('Foo bar Bli blub'); $this->buildQueryExpects('TOKEN123', [ 'id' => 0, @@ -410,14 +402,12 @@ public function testProcessMoreOptionsResult(bool $isExternalAttendee): void { PRODID:-//Nextcloud/Nextcloud CalDAV Server//EN METHOD:REPLY BEGIN:VEVENT -ATTENDEE;PARTSTAT=TENTATIVE;X-RESPONSE-COMMENT=Foo bar Bli blub;X-NUM-GUEST - S=7:mailto:attendee@foo.bar +ATTENDEE;PARTSTAT=TENTATIVE:mailto:attendee@foo.bar ORGANIZER:mailto:organizer@foo.bar UID:this-is-the-events-uid SEQUENCE:0 REQUEST-STATUS:2.0;Success DTSTAMP:19700101T002217Z -COMMENT:Foo bar Bli blub END:VEVENT END:VCALENDAR