Skip to content

Commit 27b9da6

Browse files
feature: Improved Recurrence Invitations Messages
Signed-off-by: SebastianKrupinski <[email protected]>
1 parent 713ebc2 commit 27b9da6

File tree

2 files changed

+23
-13
lines changed

2 files changed

+23
-13
lines changed

apps/dav/lib/CalDAV/EventReader.php

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function __construct(VCalendar|VEvent|array|String $input, ?string $uid =
9191
// evaluate if input is a calendar vobject
9292
} elseif ($input instanceof VCalendar) {
9393
// Calendar + UID mode.
94-
if (!$uid) {
94+
if (!isset($uid)) {
9595
throw new InvalidArgumentException('The UID argument is required when a VCALENDAR object is used');
9696
}
9797
// extract events from calendar
@@ -120,35 +120,45 @@ public function __construct(VCalendar|VEvent|array|String $input, ?string $uid =
120120
// In this particular case, we're just going to grab the first
121121
// event and use that instead. This may not always give the
122122
// desired result.
123-
if (!$this->baseEvent && count($events) > 0) {
123+
if (!isset($this->baseEvent) && count($events) > 0) {
124124
$this->baseEvent = array_shift($events);
125125
}
126126

127127
// determain the event starting time zone
128128
// we require this to align all other dates times
129129
// evaluate if timezone paramater was used (treat this as a override)
130130
if (!is_null($timeZone)) {
131-
$this->baseEventStartTimeZone = $timezone;
132-
// evaluate if start date has a timezone parameter
133-
} elseif (isset($this->baseEvent->DTSTART->parameters['TZID'])) {
131+
$this->baseEventStartTimeZone = $timeZone;
132+
}
133+
// evaluate if event start date has a timezone parameter
134+
elseif (isset($this->baseEvent->DTSTART->parameters['TZID'])) {
134135
$this->baseEventStartTimeZone = new DateTimeZone($this->baseEvent->DTSTART->parameters['TZID']->getValue());
135-
} elseif (isset($input->VTIMEZONE[0]) && isset($input->VTIMEZONE[0]->TZID)) {
136+
}
137+
// evaluate if event calendar wrapper has a time zone
138+
elseif (isset($input->VTIMEZONE[0]) && isset($input->VTIMEZONE[0]->TZID)) {
136139
$this->baseEventStartTimeZone = new DateTimeZone($input->VTIMEZONE[0]->TZID);
137-
} else {
140+
}
141+
// otherwise, as a last resort use the UTC timezone
142+
else {
138143
$this->baseEventStartTimeZone = new DateTimeZone('UTC');
139144
}
140145

141146
// determain the event end time zone
142147
// we require this to align all other dates and times
143148
// evaluate if timezone paramater was used (treat this as a override)
144149
if (!is_null($timeZone)) {
145-
$this->baseEventEndTimeZone = $timezone;
146-
// evaluate if end date has a timezone parameter
147-
} elseif (isset($this->baseEvent->DTEND->parameters['TZID'])) {
150+
$this->baseEventEndTimeZone = $timeZone;
151+
}
152+
// evaluate if event start date has a timezone parameter
153+
elseif (isset($this->baseEvent->DTEND->parameters['TZID'])) {
148154
$this->baseEventEndTimeZone = new DateTimeZone($this->baseEvent->DTEND->parameters['TZID']->getValue());
149-
} elseif (isset($input->VTIMEZONE[1]) && isset($input->VTIMEZONE[1]->TZID)) {
155+
}
156+
// evaluate if event calendar wrapper has a time zone
157+
elseif (isset($input->VTIMEZONE[1]) && isset($input->VTIMEZONE[1]->TZID)) {
150158
$this->baseEventEndTimeZone = new DateTimeZone($input->VTIMEZONE[1]->TZID);
151-
} else {
159+
}
160+
// otherwise, as a last resort use the UTC timezone
161+
else {
152162
$this->baseEventEndTimeZone = new DateTimeZone('UTC');
153163
}
154164

apps/dav/lib/CalDAV/Schedule/IMipService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ public function addAttendees(IEMailTemplate $template, VEvent $vevent) {
667667
public function addBulletList(IEMailTemplate $template, VEvent $vevent, $data) {
668668
$template->addBodyListItem(
669669
$data['meeting_title_html'] ?? $data['meeting_title'], $this->l10n->t('Title:'),
670-
$this->getAbsoluteImagePath('caldav/title.png'), $data['meeting_title'], '', IMipPlugin::IMIP_INDENT);
670+
$this->getAbsoluteImagePath('caldav/title.png'), $data['meeting_title'], '', IMipPlugin::IMIP_INDENT);
671671
if ($data['meeting_when'] !== '') {
672672
$template->addBodyListItem($data['meeting_when_html'] ?? $data['meeting_when'], $this->l10n->t('When:'),
673673
$this->getAbsoluteImagePath('caldav/time.png'), $data['meeting_when'], '', IMipPlugin::IMIP_INDENT);

0 commit comments

Comments
 (0)