diff --git a/apps/dav/lib/CalDAV/Reminder/INotificationProvider.php b/apps/dav/lib/CalDAV/Reminder/INotificationProvider.php index 505960ed66208..e8cbfdd0ab368 100644 --- a/apps/dav/lib/CalDAV/Reminder/INotificationProvider.php +++ b/apps/dav/lib/CalDAV/Reminder/INotificationProvider.php @@ -42,13 +42,13 @@ interface INotificationProvider { * Send notification * * @param VEvent $vevent - * @param string $calendarDisplayName + * @param string|null $calendarDisplayName * @param string[] $principalEmailAddresses All email addresses associated to the principal owning the calendar object * @param IUser[] $users * @return void */ public function send(VEvent $vevent, - string $calendarDisplayName, + ?string $calendarDisplayName, array $principalEmailAddresses, array $users = []): void; } diff --git a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/AbstractProvider.php b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/AbstractProvider.php index 6986328facd30..bccbec5fe3caa 100644 --- a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/AbstractProvider.php +++ b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/AbstractProvider.php @@ -82,13 +82,13 @@ public function __construct(LoggerInterface $logger, * Send notification * * @param VEvent $vevent - * @param string $calendarDisplayName + * @param string|null $calendarDisplayName * @param string[] $principalEmailAddresses * @param IUser[] $users * @return void */ abstract public function send(VEvent $vevent, - string $calendarDisplayName, + ?string $calendarDisplayName, array $principalEmailAddresses, array $users = []): void; @@ -185,4 +185,8 @@ protected function getDTEndFromEvent(VEvent $vevent):Property\ICalendar\DateTime return clone $vevent->DTSTART; } + + protected function getCalendarDisplayNameFallback(string $lang): string { + return $this->getL10NForLang($lang)->t('Untitled calendar'); + } } diff --git a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php index 3207268896779..da275efdcf19f 100644 --- a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php +++ b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php @@ -70,13 +70,13 @@ public function __construct(IConfig $config, * Send out notification via email * * @param VEvent $vevent - * @param string $calendarDisplayName + * @param string|null $calendarDisplayName * @param string[] $principalEmailAddresses * @param array $users * @throws \Exception */ public function send(VEvent $vevent, - string $calendarDisplayName, + ?string $calendarDisplayName, array $principalEmailAddresses, array $users = []):void { $fallbackLanguage = $this->getFallbackLanguage(); @@ -115,7 +115,7 @@ public function send(VEvent $vevent, $template = $this->mailer->createEMailTemplate('dav.calendarReminder'); $template->addHeader(); $this->addSubjectAndHeading($template, $l10n, $vevent); - $this->addBulletList($template, $l10n, $calendarDisplayName, $vevent); + $this->addBulletList($template, $l10n, $calendarDisplayName ?? $this->getCalendarDisplayNameFallback($lang), $vevent); $template->addFooter(); foreach ($emailAddresses as $emailAddress) { diff --git a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/PushProvider.php b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/PushProvider.php index 833d74079aa8a..be8bafd2f3569 100644 --- a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/PushProvider.php +++ b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/PushProvider.php @@ -73,13 +73,13 @@ public function __construct(IConfig $config, * Send push notification to all users. * * @param VEvent $vevent - * @param string $calendarDisplayName + * @param string|null $calendarDisplayName * @param string[] $principalEmailAddresses * @param IUser[] $users * @throws \Exception */ public function send(VEvent $vevent, - string $calendarDisplayName, + ?string $calendarDisplayName, array $principalEmailAddresses, array $users = []):void { if ($this->config->getAppValue('dav', 'sendEventRemindersPush', 'no') !== 'yes') { @@ -87,7 +87,6 @@ public function send(VEvent $vevent, } $eventDetails = $this->extractEventDetails($vevent); - $eventDetails['calendar_displayname'] = $calendarDisplayName; $eventUUID = (string) $vevent->UID; if (!$eventUUID) { return; @@ -95,6 +94,8 @@ public function send(VEvent $vevent, $eventUUIDHash = hash('sha256', $eventUUID, false); foreach ($users as $user) { + $eventDetails['calendar_displayname'] = $calendarDisplayName ?? $this->getCalendarDisplayNameFallback($this->l10nFactory->getUserLanguage($user)); + /** @var INotification $notification */ $notification = $this->manager->createNotification(); $notification->setApp(Application::APP_ID)