diff --git a/Dockerfile b/Dockerfile index d6abb4954d617c6155fd7ac980194ab28c51a30d..5d830c1512c78a494325742048e38bd5ccff672b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ ARG NEWS_VERSION="18.1.1" ARG QUOTA_WARN_VERSION="1.14.0" ARG NOTES_VERSION="4.5.1" ARG CONTACTS_JOB_ID="400045" -ARG CALENDAR_JOB_ID="414851" +ARG CALENDAR_JOB_ID="417988" ARG USER_BACKEND_RAW_SQL_VERSION="1.3.0" ARG EMAIL_RECOVERY_JOB_ID="389385" ARG RAINLOOP_VERSION="7.2.5" @@ -18,7 +18,7 @@ ARG GOOGLE_INTEGRATION_VERSION="1.0.8" ARG LDAP_WRITE_SUPPORT_VERSION="1.4.0" ARG OIDC_LOGIN_VERSION="2.3.3" -RUN sed -i 's/23,0,9,1/23,0,9,19/' ${BASE_DIR}/version.php +RUN sed -i 's/23,0,9,1/23,0,9,26/' ${BASE_DIR}/version.php COPY custom_entrypoint.sh / RUN chmod +x /custom_entrypoint.sh RUN mkdir -p /var/www/skeleton/Documents && mkdir -p /var/www/skeleton/Images @@ -136,6 +136,7 @@ RUN patch -u ${BASE_DIR}/core/Command/User/Setting.php -i ${TMP_PATCH_DIR}/018-o RUN patch -u ${BASE_DIR}/apps/settings/lib/Sections/Personal/Groupware.php -i ${TMP_PATCH_DIR}/019-groupware.patch RUN patch -u ${BASE_DIR}/lib/private/Notification/Manager.php -i ${TMP_PATCH_DIR}/020-fairuse-notification-fix.patch RUN patch -u ${BASE_DIR}/apps/files/js/files.js -i ${TMP_PATCH_DIR}/021-repeated-storage-dialog-fix.patch +RUN cd ${BASE_DIR} && patch -p0 < ${TMP_PATCH_DIR}/022-multiplenotification.patch RUN rm -rf ${TMP_PATCH_DIR} # show reset pwd page with a query param diff --git a/patches/022-multiplenotification.patch b/patches/022-multiplenotification.patch new file mode 100644 index 0000000000000000000000000000000000000000..8a7c863510468a52dfc8b62f11c0f4f243696cdd --- /dev/null +++ b/patches/022-multiplenotification.patch @@ -0,0 +1,228 @@ +From: Avinash +Date: Thu, 10 Nov 2022 12:09:27 +0100 +Subject: [PATCH] this patch solves the multiple notificaton issue in mail + +This patch fix the issue https://github.com/nextcloud/server/issues/21370 and taken the reference from https://github.com/nextcloud/server/issues/21370 + +--- ./apps/dav/lib/Connector/Sabre/Principal.php 2022-11-10 11:08:52.094653000 +0530 ++++ ./apps/dav/lib/Connector/Sabre/Principal-new.php 2022-11-10 10:42:55.194653000 +0530 +@@ -591,4 +591,43 @@ + + return []; + } ++ /** ++ * Get all email addresses associated to a principal. ++ * ++ * @param array $principal Data from getPrincipal*() ++ * @return string[] All email addresses without the mailto: prefix ++ */ ++ public function getEmailAddressesOfPrincipal(array $principal): array { ++ $emailAddresses = []; ++ ++ if (($primaryAddress = $principal['{http://sabredav.org/ns}email-address'])) { ++ $emailAddresses[] = $primaryAddress; ++ } ++ ++ if (isset($principal['{DAV:}alternate-URI-set'])) { ++ foreach ($principal['{DAV:}alternate-URI-set'] as $address) { ++ if (str_starts_with($address, 'mailto:')) { ++ $emailAddresses[] = substr($address, 7); ++ } ++ } ++ } ++ ++ if (isset($principal['{urn:ietf:params:xml:ns:caldav}calendar-user-address-set'])) { ++ foreach ($principal['{urn:ietf:params:xml:ns:caldav}calendar-user-address-set'] as $address) { ++ if (str_starts_with($address, 'mailto:')) { ++ $emailAddresses[] = substr($address, 7); ++ } ++ } ++ } ++ ++ if (isset($principal['{http://calendarserver.org/ns/}email-address-set'])) { ++ foreach ($principal['{http://calendarserver.org/ns/}email-address-set'] as $address) { ++ if (str_starts_with($address, 'mailto:')) { ++ $emailAddresses[] = substr($address, 7); ++ } ++ } ++ } ++ ++ return array_values(array_unique($emailAddresses)); ++ } + } + +--- ./apps/dav/lib/CalDAV/Schedule/Plugin.php 2022-11-10 11:07:59.044653000 +0530 ++++ ./apps/dav/lib/CalDAV/Schedule/Plugin-new.php 2022-11-10 10:44:56.934653000 +0530 +@@ -45,6 +45,7 @@ + use Sabre\VObject\Component\VCalendar; + use Sabre\VObject\Component\VEvent; + use Sabre\VObject\DateTimeParser; ++use Sabre\VObject\Document; + use Sabre\VObject\FreeBusyGenerator; + use Sabre\VObject\ITip; + use Sabre\VObject\Parameter; +@@ -163,6 +164,13 @@ + * @inheritDoc + */ + public function scheduleLocalDelivery(ITip\Message $iTipMessage):void { ++ /** @var Component|null $vevent */ ++ $vevent = $iTipMessage->message->VEVENT ?? null; ++ ++ // Strip VALARMs from incoming VEVENT ++ if ($vevent && isset($vevent->VALARM)) { ++ $vevent->remove('VALARM'); ++ } + parent::scheduleLocalDelivery($iTipMessage); + + // We only care when the message was successfully delivered locally +@@ -199,17 +207,11 @@ + return; + } + +- if (!isset($iTipMessage->message)) { ++ if (!$vevent) { + return; + } + +- $vcalendar = $iTipMessage->message; +- if (!isset($vcalendar->VEVENT)) { +- return; +- } + +- /** @var Component $vevent */ +- $vevent = $vcalendar->VEVENT; + + // We don't support autoresponses for recurrencing events for now + if (isset($vevent->RRULE) || isset($vevent->RDATE)) { + +--- ./apps/dav/lib/CalDAV/Reminder/ReminderService.php 2022-11-10 11:05:13.604653000 +0530 ++++ ./apps/dav/lib/CalDAV/Reminder/ReminderService-new.php 2022-11-10 10:53:04.134653000 +0530 +@@ -32,11 +32,14 @@ + + use DateTimeImmutable; + use OCA\DAV\CalDAV\CalDavBackend; ++use OCA\DAV\Connector\Sabre\Principal; + use OCP\AppFramework\Utility\ITimeFactory; ++use OCP\IConfig; + use OCP\IGroup; + use OCP\IGroupManager; + use OCP\IUser; + use OCP\IUserManager; ++use Psr\Log\LoggerInterface; + use Sabre\VObject; + use Sabre\VObject\Component\VAlarm; + use Sabre\VObject\Component\VEvent; +@@ -44,6 +47,7 @@ + use Sabre\VObject\ParseException; + use Sabre\VObject\Recur\EventIterator; + use Sabre\VObject\Recur\NoInstancesException; ++use function count; + use function strcasecmp; + + class ReminderService { +@@ -66,6 +70,15 @@ + /** @var ITimeFactory */ + private $timeFactory; + ++ /** @var IConfig */ ++ private $config; ++ /** @var LoggerInterface */ ++ private $logger; ++ ++ /** @var Principal */ ++ private $principalConnector; ++ ++ + public const REMINDER_TYPE_EMAIL = 'EMAIL'; + public const REMINDER_TYPE_DISPLAY = 'DISPLAY'; + public const REMINDER_TYPE_AUDIO = 'AUDIO'; +@@ -96,15 +109,20 @@ + IUserManager $userManager, + IGroupManager $groupManager, + CalDavBackend $caldavBackend, +- ITimeFactory $timeFactory) { ++ ITimeFactory $timeFactory, ++ IConfig $config, ++ LoggerInterface $logger, ++ Principal $principalConnector) { + $this->backend = $backend; + $this->notificationProviderManager = $notificationProviderManager; + $this->userManager = $userManager; + $this->groupManager = $groupManager; + $this->caldavBackend = $caldavBackend; + $this->timeFactory = $timeFactory; ++ $this->config = $config; ++ $this->logger = $logger; ++ $this->principalConnector = $principalConnector; + } +- + /** + * Process reminders to activate + * + +--- ./apps/dav/lib/CalDAV/Reminder/NotificationProvider/AbstractProvider.php 2022-11-10 11:18:14.574653000 +0530 ++++ ./apps/dav/lib/CalDAV/Reminder/NotificationProvider/AbstractProvider-new.php 2022-11-10 10:49:41.084653000 +0530 +@@ -94,6 +94,7 @@ + */ + abstract public function send(VEvent $vevent, + string $calendarDisplayName, ++ array $principalEmailAddresses, + array $users = []): void; + + /** + +--- ./apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php 2022-11-10 11:18:14.534653000 +0530 ++++ ./apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider-new.php 2022-11-10 10:51:15.364653000 +0530 +@@ -83,11 +83,23 @@ + */ + public function send(VEvent $vevent, + string $calendarDisplayName, ++ array $principalEmailAddresses, + array $users = []):void { + $fallbackLanguage = $this->getFallbackLanguage(); + ++ $organizerEmailAddress = null; ++ if (isset($vevent->ORGANIZER)) { ++ $organizerEmailAddress = $this->getEMailAddressOfAttendee($vevent->ORGANIZER); ++ } ++ + $emailAddressesOfSharees = $this->getEMailAddressesOfAllUsersWithWriteAccessToCalendar($users); + $emailAddressesOfAttendees = $this->getAllEMailAddressesFromEvent($vevent); ++ $emailAddressesOfAttendees = []; ++ if (count($principalEmailAddresses) === 0 ++ || ($organizerEmailAddress && in_array($organizerEmailAddress, $principalEmailAddresses, true)) ++ ) { ++ $emailAddressesOfAttendees = $this->getAllEMailAddressesFromEvent($vevent); ++ } + + // Quote from php.net: + // If the input arrays have the same string keys, then the later value for that key will overwrite the previous one. + +--- ./apps/dav/lib/CalDAV/Reminder/INotificationProvider.php 2022-11-10 11:06:58.304653000 +0530 ++++ ./apps/dav/lib/CalDAV/Reminder/INotificationProvider-new.php 2022-11-10 10:40:31.934653000 +0530 +@@ -47,5 +47,6 @@ + */ + public function send(VEvent $vevent, + string $calendarDisplayName, ++ array $principalEmailAddresses, + array $users = []): void; + } + +--- ./apps/dav/lib/CalDAV/Reminder/NotificationProvider/PushProvider.php 2022-11-10 11:18:14.614653000 +0530 ++++ ./apps/dav/lib/CalDAV/Reminder/NotificationProvider/PushProvider-new.php 2022-11-10 10:52:38.064653000 +0530 +@@ -85,12 +85,14 @@ + * @throws \Exception + */ + public function send(VEvent $vevent, +- string $calendarDisplayName = null, ++ string $calendarDisplayName, ++ array $principalEmailAddresses, + array $users = []):void { + if ($this->config->getAppValue('dav', 'sendEventRemindersPush', 'no') !== 'yes') { + return; + } + ++ + $eventDetails = $this->extractEventDetails($vevent); + $eventDetails['calendar_displayname'] = $calendarDisplayName; + $eventUUID = (string) $vevent->UID;