Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2576ce16 authored by Ronak Patel's avatar Ronak Patel
Browse files

015-email-mail-template.patch

parent 6e9a91c4
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -143,7 +143,7 @@ RUN patch -u ${BASE_DIR}/lib/private/Updater.php -i ${TMP_PATCH_DIR}/010-disable
RUN cd ${BASE_DIR} && patch -p0 < ${TMP_PATCH_DIR}/011-privacy-settings.patch
RUN patch -u ${BASE_DIR}/lib/private/Authentication/Token/PublicKeyTokenProvider.php -i ${TMP_PATCH_DIR}/013-revert-token-password-update.patch
RUN cd ${BASE_DIR} && patch -p0 < ${TMP_PATCH_DIR}/014-add-mail-usage.patch
# RUN cd ${BASE_DIR} && patch -p0 < ${TMP_PATCH_DIR}/015-email-mail-template.patch
RUN cd ${BASE_DIR} && patch -p0 < ${TMP_PATCH_DIR}/015-email-mail-template.patch
RUN patch -u ${BASE_DIR}/core/Command/User/Setting.php -i ${TMP_PATCH_DIR}/018-occ-user-setting.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 -u ${BASE_DIR}/3rdparty/sabre/vobject/lib/ITip/Broker.php -i ${TMP_PATCH_DIR}/022-significantchange.patch
+46 −51
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

This patch is allowing to customize the email template design for invitation

--- ./apps/dav/lib/CalDAV/Schedule/IMipPlugin.php	2023-10-19 14:18:20
+++ ./apps/dav/lib/CalDAV/Schedule/IMipPlugin-new.php	2023-10-19 14:21:42
@@ -235,6 +235,13 @@
--- ./apps/dav/lib/CalDAV/Schedule/IMipPlugin.php	2024-03-15 18:56:05
+++ ./apps/dav/lib/CalDAV/Schedule/IMipPlugin-new.php	2024-03-15 19:03:58
@@ -242,6 +242,13 @@
 		$data['invitee_name'] = ($senderName ?: $sender);
 
 		$fromEMail = Util::getDefaultEmailAddress('invitations-noreply');
@@ -20,16 +14,17 @@ This patch is allowing to customize the email template design for invitation
 		$fromName = $this->imipService->getFrom($senderName, $this->defaults->getName());
 
 		$message = $this->mailer->createMessage()
@@ -255,7 +262,22 @@
\ No newline at end of file
@@ -262,7 +269,22 @@
 		$template = $this->mailer->createEMailTemplate('dav.calendarInvite.' . $method, $data);
 		$template->addHeader();
 
-		$this->imipService->addSubjectAndHeading($template, $method, $data['invitee_name'], $data['meeting_title']);
-		$this->imipService->addSubjectAndHeading($template, $method, $data['invitee_name'], $data['meeting_title'], $isModified, $replyingAttendee);
+		$l10n = \OC::$server->getL10N('dav');
+		if ( count($vEvent)>1) {
+			$this->imipService->addSubjectAndHeadingUpdated($template, $method, $data['invitee_name'], $data['meeting_title']);
+		} else {
+			$this->imipService->addSubjectAndHeading($template, $method, $data['invitee_name'], $data['meeting_title']);
+			$this->imipService->addSubjectAndHeading($template, $method, $data['invitee_name'], $data['meeting_title'], $isModified, $replyingAttendee);
+		}
+		if ($method === self::METHOD_CANCEL) {
+			$template->addHeadingBanner('#FFC2B9','#7D1000',$l10n->t('The invitation has been cancelled'));
@@ -44,41 +39,12 @@ This patch is allowing to customize the email template design for invitation
 		$this->imipService->addBulletList($template, $vEvent, $data);
 
 		// Only add response buttons to invitation requests: Fix Issue #11230
\ No newline at end of file

--- ./apps/dav/lib/CalDAV/Schedule/IMipService.php	2023-10-19 11:40:39
+++ ./apps/dav/lib/CalDAV/Schedule/IMipService-new.php	2023-10-19 13:47:17
@@ -382,6 +382,30 @@
 	}

 	/**
+	 * @param IEMailTemplate $template
+	 * @param string $method
+	 * @param string $sender
+	 * @param string $summary
+	 * @param string|null $partstat
+	 */
+	public function addSubjectAndHeadingUpdated(IEMailTemplate $template,
+		string $method, string $sender, string $summary): void {
+		if ($method === IMipPlugin::METHOD_CANCEL) {
+			// TRANSLATORS Subject for email, when an invitation is cancelled. Ex: "Cancelled: {{Event Name}}"
+			$template->setSubject($this->l10n->t('Cancelled: %1$s', [$summary]));
+			$template->addHeading($this->l10n->t('"%1$s" has been canceled', [$summary]));
+		} elseif ($method === IMipPlugin::METHOD_REPLY) {
+			// TRANSLATORS Subject for email, when an invitation is replied to. Ex: "Re: {{Event Name}}"
+			$template->setSubject($this->l10n->t('Re: %1$s', [$summary]));
+			$template->addHeading($this->l10n->t('%1$s has responded to your invitation', [$sender]));
+		} else {
+			// TRANSLATORS Subject for email, when an invitation is sent. Ex: "Invitation: {{Event Name}}"
+			$template->setSubject($this->l10n->t('Invitation Updated: %1$s', [$summary]));
+			$template->addHeading($this->l10n->t('%1$s would like to invite you to "%2$s"', [$sender, $summary]));
+		}
+	}
+
+	/**
 	 * @param string $path
 	 * @return string
 	 */
@@ -479,8 +503,13 @@
--- ./apps/dav/lib/CalDAV/Schedule/IMipService.php	2024-03-15 18:58:59
+++ ./apps/dav/lib/CalDAV/Schedule/IMipService-new.php	2024-03-15 19:02:34
@@ -541,8 +541,13 @@
 				$this->getAbsoluteImagePath('caldav/time.png'), $data['meeting_when'], '', IMipPlugin::IMIP_INDENT);
 		}
 		if ($data['meeting_location'] !== '') {
@@ -94,7 +60,7 @@ This patch is allowing to customize the email template design for invitation
 		}
 		if ($data['meeting_url'] !== '') {
 			$template->addBodyListItem($data['meeting_url_html'] ?? $data['meeting_url'], $this->l10n->t('Link:'),
@@ -575,7 +604,7 @@
@@ -637,7 +642,7 @@
 	 * @param $token
 	 */
 	public function addResponseButtons(IEMailTemplate $template, $token) {
@@ -103,7 +69,7 @@ This patch is allowing to customize the email template design for invitation
 			$this->l10n->t('Accept'),
 			$this->urlGenerator->linkToRouteAbsolute('dav.invitation_response.accept', [
 				'token' => $token,
@@ -583,19 +612,12 @@
@@ -645,20 +650,13 @@
 			$this->l10n->t('Decline'),
 			$this->urlGenerator->linkToRouteAbsolute('dav.invitation_response.decline', [
 				'token' => $token,
@@ -125,6 +91,35 @@ This patch is allowing to customize the email template design for invitation
-
-		$template->addBodyText($html, $text);
 	}
 }
\ No newline at end of file
 
 	public function getReplyingAttendee(Message $iTipMessage): ?Property {
@@ -686,4 +684,29 @@
 		}
 		return false;
 	}
+
+	/**
+	* @param IEMailTemplate $template
+	* @param string $method
+	* @param string $sender
+	* @param string $summary
+	* @param string|null $partstat
+	*/
+	public function addSubjectAndHeadingUpdated(IEMailTemplate $template,
+		string $method, string $sender, string $summary): void {
+		if ($method === IMipPlugin::METHOD_CANCEL) {
+			// TRANSLATORS Subject for email, when an invitation is cancelled. Ex: "Cancelled: {{Event Name}}"
+			$template->setSubject($this->l10n->t('Cancelled: %1$s', [$summary]));
+			$template->addHeading($this->l10n->t('"%1$s" has been canceled', [$summary]));
+		} elseif ($method === IMipPlugin::METHOD_REPLY) {
+			// TRANSLATORS Subject for email, when an invitation is replied to. Ex: "Re: {{Event Name}}"
+			$template->setSubject($this->l10n->t('Re: %1$s', [$summary]));
+			$template->addHeading($this->l10n->t('%1$s has responded to your invitation', [$sender]));
+		} else {
+			// TRANSLATORS Subject for email, when an invitation is sent. Ex: "Invitation: {{Event Name}}"
+			$template->setSubject($this->l10n->t('Invitation Updated: %1$s', [$summary]));
+			$template->addHeading($this->l10n->t('%1$s would like to invite you to "%2$s"', [$sender, $summary]));
+		}
+	}
+
 }