summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2023-05-17 15:56:11 +0200
committerGitHub <noreply@github.com>2023-05-17 15:56:11 +0200
commitbf716861a733605fec6b66d5a547f26f868779b7 (patch)
tree5e378410cc1f91b756db69ee27b39e7c03832858 /apps
parentf8058a0d09906e0820ce00e634cccdf9cbfd3712 (diff)
parentf3f37001b4c0cf72dbe13ecbc30dac0db1c3f694 (diff)
downloadnextcloud-server-bf716861a733605fec6b66d5a547f26f868779b7.tar.gz
nextcloud-server-bf716861a733605fec6b66d5a547f26f868779b7.zip
Merge pull request #37769 from nextcloud/backport/36217/stable25
[stable25] Handle reminders where calendar name is null
Diffstat (limited to 'apps')
-rw-r--r--apps/dav/lib/CalDAV/Reminder/INotificationProvider.php4
-rw-r--r--apps/dav/lib/CalDAV/Reminder/NotificationProvider/AbstractProvider.php8
-rw-r--r--apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php6
-rw-r--r--apps/dav/lib/CalDAV/Reminder/NotificationProvider/PushProvider.php7
4 files changed, 15 insertions, 10 deletions
diff --git a/apps/dav/lib/CalDAV/Reminder/INotificationProvider.php b/apps/dav/lib/CalDAV/Reminder/INotificationProvider.php
index 505960ed662..e8cbfdd0ab3 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 6986328facd..bccbec5fe3c 100644
--- a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/AbstractProvider.php
+++ b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/AbstractProvider.php
@@ -82,13 +82,13 @@ abstract class AbstractProvider implements INotificationProvider {
* 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 @@ abstract class AbstractProvider implements INotificationProvider {
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 c2e68605d17..96cbc650006 100644
--- a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php
+++ b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php
@@ -70,13 +70,13 @@ class EmailProvider extends AbstractProvider {
* 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 @@ class EmailProvider extends AbstractProvider {
$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 833d74079aa..be8bafd2f35 100644
--- a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/PushProvider.php
+++ b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/PushProvider.php
@@ -73,13 +73,13 @@ class PushProvider extends AbstractProvider {
* 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 @@ class PushProvider extends AbstractProvider {
}
$eventDetails = $this->extractEventDetails($vevent);
- $eventDetails['calendar_displayname'] = $calendarDisplayName;
$eventUUID = (string) $vevent->UID;
if (!$eventUUID) {
return;
@@ -95,6 +94,8 @@ class PushProvider extends AbstractProvider {
$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)