-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(caldav): Only track interactions of event organizers
Signed-off-by: Christoph Wurst <[email protected]>
- Loading branch information
1 parent
6cb75e8
commit 34d12a7
Showing
2 changed files
with
73 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -135,14 +135,63 @@ public function testParseCalendarEventWithInvalidEmail(): void { | |
DTSTART;TZID=Europe/Vienna:20210202T103000 | ||
DTEND;TZID=Europe/Vienna:20210202T133000 | ||
SUMMARY:tes | ||
ORGANIZER;CN=admin:mailto:[email protected] | ||
ORGANIZER;CN=admin:mailto:[email protected] | ||
ATTENDEE;CN=somethingbutnotanemail;CUTYPE=INDIVIDUAL;PARTSTAT=NEEDS-ACTION; | ||
ROLE=REQ-PARTICIPANT;RSVP=FALSE:mailto:somethingbutnotanemail | ||
DESCRIPTION:test | ||
END:VEVENT | ||
END:VCALENDAR | ||
EVENT]); | ||
$user = $this->createMock(IUser::class); | ||
$user->method('getPrimaryEMailAddress')->willReturn('[email protected]'); | ||
$this->userSession->expects(self::once())->method('getUser')->willReturn($user); | ||
$this->eventDispatcher->expects(self::never())->method('dispatchTyped'); | ||
$this->logger->expects(self::never())->method('warning'); | ||
|
||
$this->listener->handle($event); | ||
} | ||
|
||
public function testParseImportedEventWithUnknownOrganizer(): void { | ||
$event = new CalendarObjectCreatedEvent(123, [], [], ['calendardata' => <<<EVENT | ||
BEGIN:VCALENDAR | ||
VERSION:2.0 | ||
CALSCALE:GREGORIAN | ||
PRODID:-//IDN nextcloud.com//Calendar app 2.1.3//EN | ||
BEGIN:VTIMEZONE | ||
TZID:Europe/Vienna | ||
BEGIN:DAYLIGHT | ||
TZOFFSETFROM:+0100 | ||
TZOFFSETTO:+0200 | ||
TZNAME:CEST | ||
DTSTART:19700329T020000 | ||
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU | ||
END:DAYLIGHT | ||
BEGIN:STANDARD | ||
TZOFFSETFROM:+0200 | ||
TZOFFSETTO:+0100 | ||
TZNAME:CET | ||
DTSTART:19701025T030000 | ||
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU | ||
END:STANDARD | ||
END:VTIMEZONE | ||
BEGIN:VEVENT | ||
CREATED:20210202T091151Z | ||
DTSTAMP:20210203T130231Z | ||
LAST-MODIFIED:20210203T130231Z | ||
SEQUENCE:9 | ||
UID:b74a0c8e-93b0-447f-aed5-b679b19e874a | ||
DTSTART;TZID=Europe/Vienna:20210202T103000 | ||
DTEND;TZID=Europe/Vienna:20210202T133000 | ||
SUMMARY:tes | ||
ORGANIZER;CN=admin:mailto:[email protected] | ||
ATTENDEE;CN=somethingbutnotanemail;CUTYPE=INDIVIDUAL;PARTSTAT=NEEDS-ACTION; | ||
ROLE=REQ-PARTICIPANT;RSVP=FALSE:mailto:somethingbutnotanemail | ||
DESCRIPTION:test | ||
END:VEVENT | ||
END:VCALENDAR | ||
EVENT]); | ||
$user = $this->createMock(IUser::class); | ||
$user->method('getPrimaryEMailAddress')->willReturn('[email protected]'); | ||
$this->userSession->expects(self::once())->method('getUser')->willReturn($user); | ||
$this->eventDispatcher->expects(self::never())->method('dispatchTyped'); | ||
$this->logger->expects(self::never())->method('warning'); | ||
|
@@ -182,14 +231,15 @@ public function testParseCalendarEvent(): void { | |
DTSTART;TZID=Europe/Vienna:20210202T103000 | ||
DTEND;TZID=Europe/Vienna:20210202T133000 | ||
SUMMARY:tes | ||
ORGANIZER;CN=admin:mailto:[email protected] | ||
ORGANIZER;CN=admin:mailto:[email protected] | ||
ATTENDEE;[email protected];CUTYPE=INDIVIDUAL;PARTSTAT=NEEDS-ACTION; | ||
ROLE=REQ-PARTICIPANT;RSVP=FALSE:mailto:[email protected] | ||
DESCRIPTION:test | ||
END:VEVENT | ||
END:VCALENDAR | ||
EVENT]); | ||
$user = $this->createMock(IUser::class); | ||
$user->method('getPrimaryEMailAddress')->willReturn('[email protected]'); | ||
$this->userSession->expects(self::once())->method('getUser')->willReturn($user); | ||
$this->mailer->expects(self::once())->method('validateMailAddress')->willReturn(true); | ||
$this->eventDispatcher->expects(self::once()) | ||
|