From 1a1ad081eccd5b1aea9765f3b9f36b5eb178d577 Mon Sep 17 00:00:00 2001 From: Justin Baur Date: Thu, 18 Nov 2021 09:22:50 -0500 Subject: [PATCH] Switch to handlebars ifs --- .../OrganizationUserInvited.html.hbs | 4 ++++ .../OrganizationUserInvited.text.hbs | 3 +++ ...izationUserInvitedWithSponsorship.html.hbs | 23 ------------------- ...izationUserInvitedWithSponsorship.text.hbs | 10 -------- .../Mail/OrganizationUserInvitedViewModel.cs | 1 + .../Implementations/HandlebarsMailService.cs | 3 ++- 6 files changed, 10 insertions(+), 34 deletions(-) delete mode 100644 src/Core/MailTemplates/Handlebars/OrganizationUserInvitedWithSponsorship.html.hbs delete mode 100644 src/Core/MailTemplates/Handlebars/OrganizationUserInvitedWithSponsorship.text.hbs diff --git a/src/Core/MailTemplates/Handlebars/OrganizationUserInvited.html.hbs b/src/Core/MailTemplates/Handlebars/OrganizationUserInvited.html.hbs index 99c1ae93ef..69b135dd62 100644 --- a/src/Core/MailTemplates/Handlebars/OrganizationUserInvited.html.hbs +++ b/src/Core/MailTemplates/Handlebars/OrganizationUserInvited.html.hbs @@ -15,6 +15,10 @@ If you do not wish to join this organization, you can safely ignore this email. + {{#if OrgCanSponsor}} +
+ Did you know? Members of {{OrganizationName}} receive a complimentary Families subscription. Learn more at the following link: https://bitwarden.com/help/article/about-bitwarden-plans/#families-organizations" + {{/if}} diff --git a/src/Core/MailTemplates/Handlebars/OrganizationUserInvited.text.hbs b/src/Core/MailTemplates/Handlebars/OrganizationUserInvited.text.hbs index ed0ec4261f..3dc230c5e2 100644 --- a/src/Core/MailTemplates/Handlebars/OrganizationUserInvited.text.hbs +++ b/src/Core/MailTemplates/Handlebars/OrganizationUserInvited.text.hbs @@ -6,4 +6,7 @@ You have been invited to join the {{OrganizationName}} organization. To accept t This link expires on {{ExpirationDate}}. If you do not wish to join this organization, you can safely ignore this email. +{{#if OrgCanSponsor}} +Did you know? Members of {{OrganizationName}} receive a complimentary Families subscription. Learn more here: https://bitwarden.com/help/article/about-bitwarden-plans/#families-organizations +{{/if}} {{/BasicTextLayout}} diff --git a/src/Core/MailTemplates/Handlebars/OrganizationUserInvitedWithSponsorship.html.hbs b/src/Core/MailTemplates/Handlebars/OrganizationUserInvitedWithSponsorship.html.hbs deleted file mode 100644 index dd1bfbe006..0000000000 --- a/src/Core/MailTemplates/Handlebars/OrganizationUserInvitedWithSponsorship.html.hbs +++ /dev/null @@ -1,23 +0,0 @@ -{{#>FullHtmlLayout}} - - - - - - - - - - -
- You have been invited to join the {{OrganizationName}} organization. This link expires on {{ExpirationDate}}. -
- - Join Organization Now - -
- If you do not wish to join this organization, you can safely ignore this email. -
- Did you know? Members of {{OrganizationName}} receive a complimentary Families subscription. Learn more here. -
-{{/FullHtmlLayout}} diff --git a/src/Core/MailTemplates/Handlebars/OrganizationUserInvitedWithSponsorship.text.hbs b/src/Core/MailTemplates/Handlebars/OrganizationUserInvitedWithSponsorship.text.hbs deleted file mode 100644 index 3e0773a91a..0000000000 --- a/src/Core/MailTemplates/Handlebars/OrganizationUserInvitedWithSponsorship.text.hbs +++ /dev/null @@ -1,10 +0,0 @@ -{{#>BasicTextLayout}} -You have been invited to join the {{OrganizationName}} organization. To accept this invite, click the following link: - -{{{Url}}} - -This link expires on {{ExpirationDate}}. - -If you do not wish to join this organization, you can safely ignore this email. -Did you know? Members of {{OrganizationName}} receive a complimentary Families subscription. Learn more here: https://bitwarden.com/help/article/about-bitwarden-plans/#families-organizations -{{/BasicTextLayout}} diff --git a/src/Core/Models/Mail/OrganizationUserInvitedViewModel.cs b/src/Core/Models/Mail/OrganizationUserInvitedViewModel.cs index 36509f5bbf..6b3c23d537 100644 --- a/src/Core/Models/Mail/OrganizationUserInvitedViewModel.cs +++ b/src/Core/Models/Mail/OrganizationUserInvitedViewModel.cs @@ -11,6 +11,7 @@ namespace Bit.Core.Models.Mail public string OrganizationNameUrlEncoded { get; set; } public string Token { get; set; } public string ExpirationDate { get; set; } + public bool OrgCanSponsor { get; set; } public string Url => string.Format("{0}/accept-organization?organizationId={1}&" + "organizationUserId={2}&email={3}&organizationName={4}&token={5}", WebVaultUrl, diff --git a/src/Core/Services/Implementations/HandlebarsMailService.cs b/src/Core/Services/Implementations/HandlebarsMailService.cs index b0a6a4365c..c574c88927 100644 --- a/src/Core/Services/Implementations/HandlebarsMailService.cs +++ b/src/Core/Services/Implementations/HandlebarsMailService.cs @@ -213,7 +213,7 @@ namespace Bit.Core.Services MailQueueMessage CreateMessage(string email, object model) { var message = CreateDefaultMessage($"Join {organizationName}", email); - return new MailQueueMessage(message, orgCanSponsor ? "OrganizationUserInvitedWithSponsorship" : "OrganizationUserInvited", model); + return new MailQueueMessage(message, "OrganizationUserInvited", model); } var messageModels = invites.Select(invite => CreateMessage(invite.orgUser.Email, @@ -228,6 +228,7 @@ namespace Bit.Core.Services OrganizationNameUrlEncoded = WebUtility.UrlEncode(organizationName), WebVaultUrl = _globalSettings.BaseServiceUri.VaultWithHash, SiteName = _globalSettings.SiteName, + OrgCanSponsor = orgCanSponsor, } ));