Loading patches/015-email-mail-template.patch +31 −15 Original line number Diff line number Diff line From: Avinash <avinashg@e.email> Date: Tue, 15 Nov 2022 12:50 +0530 Subject: [PATCH] To implement custom email template design for calendar invite --- apps/dav/lib/CalDAV/Schedule/IMipPlugin.php 2022-11-25 12:52:41.013768000 +0530 +++ apps/dav/lib/CalDAV/Schedule/iMipPluginNew.php 2022-11-25 12:53:18.603768000 +0530 @@ -237,6 +237,14 @@ ]; This patch is allowing to customize the email template design for invitation $fromEMail = Util::getDefaultEmailAddress('invitations-noreply'); + //if sender name is empty sometimes in case of email client + if ($senderName === null || empty(trim($senderName))) { + $users = $this->userManager->getByEmail($sender); + if (count($users) === 1) { + $senderName = $users[0]->getDisplayName(); + } + } + $fromName = $l10n->t('%1$s via %2$s', [$senderName, $this->defaults->getName()]); --- ./apps/dav/lib/CalDAV/Schedule/IMipPlugin.php 2022-11-10 10:39:19.134653000 +0530 +++ ./apps/dav/lib/CalDAV/Schedule/iMipPluginNew.php 2022-11-11 12:28:15.829119700 +0530 @@ -252,7 +252,21 @@ $message = $this->mailer->createMessage() @@ -252,7 +260,21 @@ $summary = ((string) $summary !== '') ? (string) $summary : $l10n->t('Untitled event'); Loading @@ -29,7 +38,7 @@ This patch is allowing to customize the email template design for invitation $this->addBulletList($template, $l10n, $vevent); // Only add response buttons to invitation requests: Fix Issue #11230 @@ -516,6 +530,7 @@ @@ -516,6 +538,7 @@ return $dtStart->format('Y-m-d') === $dtEnd->format('Y-m-d'); } Loading @@ -37,7 +46,7 @@ This patch is allowing to customize the email template design for invitation /** * @param IEMailTemplate $template * @param IL10N $l10n @@ -542,24 +557,86 @@ @@ -542,24 +565,86 @@ /** * @param IEMailTemplate $template * @param IL10N $l10n Loading Loading @@ -79,8 +88,7 @@ This patch is allowing to customize the email template design for invitation + $lastmodified=$dtstampTime; + $selectedEvent = $currentevent; + } } - $meetingWhen = $this->generateWhenString($l10n, $vevent); + } + if ($selectedEvent->SUMMARY) { + if (trim($selectedEvent->SUMMARY) == trim($parentevent->SUMMARY)) { + $template->addBodyListItem($selectedEvent->SUMMARY, $l10n->t('Title:'), Loading @@ -89,7 +97,8 @@ This patch is allowing to customize the email template design for invitation + $template->addBodyListItemModified($selectedEvent->SUMMARY, $l10n->t('Updated Title:'), + $this->getAbsoluteImagePath('caldav/title.png'),'','',self::IMIP_INDENT); + } + } } - $meetingWhen = $this->generateWhenString($l10n, $vevent); + $meetingWhen = $this->generateWhenString($l10n, $selectedEvent); if ($meetingWhen) { - $template->addBodyListItem($meetingWhen, $l10n->t('Time:'), Loading Loading @@ -135,7 +144,7 @@ This patch is allowing to customize the email template design for invitation $template->addBodyListItem(sprintf('<a href="%s">%s</a>', htmlspecialchars($url), htmlspecialchars($url)), @@ -567,13 +644,16 @@ @@ -567,13 +652,16 @@ $this->getAbsoluteImagePath('caldav/link.png'), $url,'',self::IMIP_INDENT); } Loading @@ -158,7 +167,7 @@ This patch is allowing to customize the email template design for invitation } } @@ -662,7 +742,7 @@ @@ -662,7 +750,7 @@ Message $iTipMessage, $lastOccurrence) { $token = $this->createInvitationToken($iTipMessage, $lastOccurrence); Loading @@ -167,7 +176,7 @@ This patch is allowing to customize the email template design for invitation $l10n->t('Accept'), $this->urlGenerator->linkToRouteAbsolute('dav.invitation_response.accept', [ 'token' => $token, @@ -670,18 +750,10 @@ @@ -670,18 +758,10 @@ $l10n->t('Decline'), $this->urlGenerator->linkToRouteAbsolute('dav.invitation_response.decline', [ 'token' => $token, Loading @@ -189,3 +198,10 @@ This patch is allowing to customize the email template design for invitation } /** @@ -726,4 +806,4 @@ return $token; } -} \ No newline at end of file +} Loading
patches/015-email-mail-template.patch +31 −15 Original line number Diff line number Diff line From: Avinash <avinashg@e.email> Date: Tue, 15 Nov 2022 12:50 +0530 Subject: [PATCH] To implement custom email template design for calendar invite --- apps/dav/lib/CalDAV/Schedule/IMipPlugin.php 2022-11-25 12:52:41.013768000 +0530 +++ apps/dav/lib/CalDAV/Schedule/iMipPluginNew.php 2022-11-25 12:53:18.603768000 +0530 @@ -237,6 +237,14 @@ ]; This patch is allowing to customize the email template design for invitation $fromEMail = Util::getDefaultEmailAddress('invitations-noreply'); + //if sender name is empty sometimes in case of email client + if ($senderName === null || empty(trim($senderName))) { + $users = $this->userManager->getByEmail($sender); + if (count($users) === 1) { + $senderName = $users[0]->getDisplayName(); + } + } + $fromName = $l10n->t('%1$s via %2$s', [$senderName, $this->defaults->getName()]); --- ./apps/dav/lib/CalDAV/Schedule/IMipPlugin.php 2022-11-10 10:39:19.134653000 +0530 +++ ./apps/dav/lib/CalDAV/Schedule/iMipPluginNew.php 2022-11-11 12:28:15.829119700 +0530 @@ -252,7 +252,21 @@ $message = $this->mailer->createMessage() @@ -252,7 +260,21 @@ $summary = ((string) $summary !== '') ? (string) $summary : $l10n->t('Untitled event'); Loading @@ -29,7 +38,7 @@ This patch is allowing to customize the email template design for invitation $this->addBulletList($template, $l10n, $vevent); // Only add response buttons to invitation requests: Fix Issue #11230 @@ -516,6 +530,7 @@ @@ -516,6 +538,7 @@ return $dtStart->format('Y-m-d') === $dtEnd->format('Y-m-d'); } Loading @@ -37,7 +46,7 @@ This patch is allowing to customize the email template design for invitation /** * @param IEMailTemplate $template * @param IL10N $l10n @@ -542,24 +557,86 @@ @@ -542,24 +565,86 @@ /** * @param IEMailTemplate $template * @param IL10N $l10n Loading Loading @@ -79,8 +88,7 @@ This patch is allowing to customize the email template design for invitation + $lastmodified=$dtstampTime; + $selectedEvent = $currentevent; + } } - $meetingWhen = $this->generateWhenString($l10n, $vevent); + } + if ($selectedEvent->SUMMARY) { + if (trim($selectedEvent->SUMMARY) == trim($parentevent->SUMMARY)) { + $template->addBodyListItem($selectedEvent->SUMMARY, $l10n->t('Title:'), Loading @@ -89,7 +97,8 @@ This patch is allowing to customize the email template design for invitation + $template->addBodyListItemModified($selectedEvent->SUMMARY, $l10n->t('Updated Title:'), + $this->getAbsoluteImagePath('caldav/title.png'),'','',self::IMIP_INDENT); + } + } } - $meetingWhen = $this->generateWhenString($l10n, $vevent); + $meetingWhen = $this->generateWhenString($l10n, $selectedEvent); if ($meetingWhen) { - $template->addBodyListItem($meetingWhen, $l10n->t('Time:'), Loading Loading @@ -135,7 +144,7 @@ This patch is allowing to customize the email template design for invitation $template->addBodyListItem(sprintf('<a href="%s">%s</a>', htmlspecialchars($url), htmlspecialchars($url)), @@ -567,13 +644,16 @@ @@ -567,13 +652,16 @@ $this->getAbsoluteImagePath('caldav/link.png'), $url,'',self::IMIP_INDENT); } Loading @@ -158,7 +167,7 @@ This patch is allowing to customize the email template design for invitation } } @@ -662,7 +742,7 @@ @@ -662,7 +750,7 @@ Message $iTipMessage, $lastOccurrence) { $token = $this->createInvitationToken($iTipMessage, $lastOccurrence); Loading @@ -167,7 +176,7 @@ This patch is allowing to customize the email template design for invitation $l10n->t('Accept'), $this->urlGenerator->linkToRouteAbsolute('dav.invitation_response.accept', [ 'token' => $token, @@ -670,18 +750,10 @@ @@ -670,18 +758,10 @@ $l10n->t('Decline'), $this->urlGenerator->linkToRouteAbsolute('dav.invitation_response.decline', [ 'token' => $token, Loading @@ -189,3 +198,10 @@ This patch is allowing to customize the email template design for invitation } /** @@ -726,4 +806,4 @@ return $token; } -} \ No newline at end of file +}