From dbfef05f0c7ac37b255d9933fdfa07a5bd7d29a4 Mon Sep 17 00:00:00 2001
From: Andrei Cioromila <andrei.cioromila@thinslices.com>
Date: Tue, 30 Oct 2018 15:38:48 +0200
Subject: [PATCH] feat(emaiTemplate): use emailProps property to compile notif
 body

---
 .../src/EmailTemplate.js                      | 19 +++++++++++--------
 ...rs.test.js => HTMLTemplateService.test.js} |  0
 2 files changed, 11 insertions(+), 8 deletions(-)
 rename packages/component-email-templating/tests/{helpers.test.js => HTMLTemplateService.test.js} (100%)

diff --git a/packages/component-email-templating/src/EmailTemplate.js b/packages/component-email-templating/src/EmailTemplate.js
index 0887072c9..f703ae470 100644
--- a/packages/component-email-templating/src/EmailTemplate.js
+++ b/packages/component-email-templating/src/EmailTemplate.js
@@ -58,7 +58,7 @@ class EmailTemplate {
         replacements: {
           ...configData,
           ...this.content,
-          ...emailBodyProps,
+          ...this.bodyProps,
           toEmail: this.toUser.email,
           toUserName: this.toUser.name,
         },
@@ -69,28 +69,31 @@ class EmailTemplate {
     }
   }
 
-  _getNotificationBody({ emailBodyProps }) {
+  _getNotificationBody() {
     return {
       html: htmlTemplateService.getCompiledNotificationBody({
         replacements: {
           ...configData,
           ...this.content,
-          ...emailBodyProps,
+          ...this.bodyProps,
           toEmail: this.toUser.email,
           toUserName: this.toUser.name,
         },
       }),
-      text: `${emailBodyProps.paragraph} ${this.content.ctaLink} ${
+      text: `${this.content.paragraph} ${this.content.ctaLink} ${
         this.content.ctaText
       } ${this.content.signatureName}`,
     }
   }
 
+  _getEmailTemplate() {
+    return this.templateType === 'notification'
+      ? this._getNotificationBody()
+      : this._getInvitationBody()
+  }
+
   async sendEmail() {
-    const { html, text } =
-      this.templateType === 'notification'
-        ? this._getNotificationBody()
-        : this._getInvitationBody()
+    const { html, text } = this._getEmailTemplate()
 
     const { fromEmail: from } = this
     const { email: to } = this.toUser
diff --git a/packages/component-email-templating/tests/helpers.test.js b/packages/component-email-templating/tests/HTMLTemplateService.test.js
similarity index 100%
rename from packages/component-email-templating/tests/helpers.test.js
rename to packages/component-email-templating/tests/HTMLTemplateService.test.js
-- 
GitLab