From 3c5b6fa6e94be75d15a15061d378b007a54f5d80 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Fri, 25 Nov 2022 13:16:56 +0530 Subject: [PATCH 1/2] display name fix --- patches/015-email-mail-template.patch | 46 ++++++++++++++++++--------- 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/patches/015-email-mail-template.patch b/patches/015-email-mail-template.patch index 72af74d7..594fee53 100644 --- a/patches/015-email-mail-template.patch +++ b/patches/015-email-mail-template.patch @@ -1,12 +1,21 @@ -From: Avinash -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'); @@ -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'); } @@ -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 @@ -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:'), @@ -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:'), @@ -135,7 +144,7 @@ This patch is allowing to customize the email template design for invitation $template->addBodyListItem(sprintf('%s', htmlspecialchars($url), htmlspecialchars($url)), -@@ -567,13 +644,16 @@ +@@ -567,13 +652,16 @@ $this->getAbsoluteImagePath('caldav/link.png'), $url,'',self::IMIP_INDENT); } @@ -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); @@ -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, @@ -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 ++} -- GitLab From c4e4eb5c7fe2241bcfac890c9dddfdfb4f64a62c Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Fri, 25 Nov 2022 15:07:09 +0530 Subject: [PATCH 2/2] display name fix --- patches/015-email-mail-template.patch | 32 +++++++++++++-------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/patches/015-email-mail-template.patch b/patches/015-email-mail-template.patch index 594fee53..646253b9 100644 --- a/patches/015-email-mail-template.patch +++ b/patches/015-email-mail-template.patch @@ -1,6 +1,12 @@ ---- 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 @@ +From: Avinash +Date: Tue, 15 Nov 2022 12:50 +0530 +Subject: [PATCH] To implement custom email template design for calendar invite + +This patch is allowing to customize the email template design for invitation + +--- apps/dav-4/lib/CalDAV/Schedule/IMipPlugin.php 2022-11-10 10:39:19.134653000 +0530 ++++ apps/dav-4/lib/CalDAV/Schedule/iMipPluginNew.php 2022-11-25 15:05:11.443768000 +0530 +@@ -237,6 +237,13 @@ ]; $fromEMail = Util::getDefaultEmailAddress('invitations-noreply'); @@ -11,11 +17,10 @@ + $senderName = $users[0]->getDisplayName(); + } + } -+ $fromName = $l10n->t('%1$s via %2$s', [$senderName, $this->defaults->getName()]); $message = $this->mailer->createMessage() -@@ -252,7 +260,21 @@ +@@ -252,7 +259,21 @@ $summary = ((string) $summary !== '') ? (string) $summary : $l10n->t('Untitled event'); @@ -38,7 +43,7 @@ $this->addBulletList($template, $l10n, $vevent); // Only add response buttons to invitation requests: Fix Issue #11230 -@@ -516,6 +538,7 @@ +@@ -516,6 +537,7 @@ return $dtStart->format('Y-m-d') === $dtEnd->format('Y-m-d'); } @@ -46,7 +51,7 @@ /** * @param IEMailTemplate $template * @param IL10N $l10n -@@ -542,24 +565,86 @@ +@@ -542,24 +564,86 @@ /** * @param IEMailTemplate $template * @param IL10N $l10n @@ -144,7 +149,7 @@ $template->addBodyListItem(sprintf('%s', htmlspecialchars($url), htmlspecialchars($url)), -@@ -567,13 +652,16 @@ +@@ -567,13 +651,16 @@ $this->getAbsoluteImagePath('caldav/link.png'), $url,'',self::IMIP_INDENT); } @@ -167,7 +172,7 @@ } } -@@ -662,7 +750,7 @@ +@@ -662,7 +749,7 @@ Message $iTipMessage, $lastOccurrence) { $token = $this->createInvitationToken($iTipMessage, $lastOccurrence); @@ -176,7 +181,7 @@ $l10n->t('Accept'), $this->urlGenerator->linkToRouteAbsolute('dav.invitation_response.accept', [ 'token' => $token, -@@ -670,18 +758,10 @@ +@@ -670,18 +757,10 @@ $l10n->t('Decline'), $this->urlGenerator->linkToRouteAbsolute('dav.invitation_response.decline', [ 'token' => $token, @@ -198,10 +203,3 @@ } /** -@@ -726,4 +806,4 @@ - - return $token; - } --} -\ No newline at end of file -+} -- GitLab