Skip to content

Commit

Permalink
Add SaaS email notification (RedHatInsights#2794)
Browse files Browse the repository at this point in the history
* WIP - Format AaaS email

* Wording updates

* Update notifyCustomerProvisionSuccessEmailBodyV2.html

* Include env URL and remove button

Fix email title as well
  • Loading branch information
zkayyali812 authored Jul 3, 2024
1 parent efa0237 commit b1f2eba
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
{@boolean renderSection1=true}
{@boolean renderButtonSection1=true}
{@boolean renderButtonSection1=false}
{#include Common/insightsEmailBody}
{#content-title}
Ansible Automation Platform Service on AWS - Ansible Automation Platform
Ansible Automation Platform Service on AWS
{/content-title}
{#content-title-section1}
Environment is ready
Ansible Automation Platform is ready
{/content-title-section1}
{#content-body-section1}
<p>Requested environment '{action.context.env_name}' is ready.</p>
<p>Requested environment '{action.context.env_name}' is ready. You can find the environment details <a href="{environment.url}/ansible/service/instances" target="_blank">here</a>.</p>
<p>Click the secure link below to access your environment's initial password.</p>
<p><b>You can access the initial password from the link only once.</b></p>
<p><b>Change the initial password as soon as possible.</b></p>
<p><a href="{action.context.bitwarden_url}" target="_blank">{action.context.bitwarden_url}</a></p>
<p>If the password is lost, open a <a href="https://www.redhat.com/en/services/support" target="_blank">support ticket</a> to request a password reset.</p>

<p>Visit the product <a href="https://docs.redhat.com/en/documentation/red_hat_ansible_automation_platform" target="_blank">documentation</a> for help getting started with Ansible Automation Platform.</p>
{/content-body-section1}
{/include}

Original file line number Diff line number Diff line change
@@ -1 +1 @@
Instant notification - Notify customer environment is ready - Ansible Automation Platform Service on AWS - Ansible Automation Platform
Environment is ready - Ansible Automation Platform Service on AWS
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ public static Action createComplianceAction() {
return emailActionMessage;
}

public static Action createAnsibleAction(String eventType, String envName) {
public static Action createAnsibleAction(String eventType, String envName, String bitwardenURL) {
Action emailActionMessage = new Action();
emailActionMessage.setBundle(StringUtils.EMPTY);
emailActionMessage.setApplication(StringUtils.EMPTY);
Expand All @@ -365,6 +365,7 @@ public static Action createAnsibleAction(String eventType, String envName) {
emailActionMessage.setContext(
new Context.ContextBuilder()
.withAdditionalProperty("env_name", envName)
.withAdditionalProperty("bitwarden_url", bitwardenURL)
.build()
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,21 @@ protected List<String> getUsedEventTypeNames() {

@Test
public void testInstantEmailTitle() {
Action action = TestHelpers.createAnsibleAction(NOTIFY_CUSTOMER_PROVISION_SUCCESS, null);
Action action = TestHelpers.createAnsibleAction(NOTIFY_CUSTOMER_PROVISION_SUCCESS, null, null);

String result = generateEmailSubject(NOTIFY_CUSTOMER_PROVISION_SUCCESS, action);
assertEquals("Instant notification - Notify customer environment is ready - Ansible Automation Platform Service on AWS - Ansible Automation Platform", result);
assertEquals("Environment is ready - Ansible Automation Platform Service on AWS", result);
}

@Test
public void testInstantEmailBody() {
String envName = RandomStringUtils.randomAlphanumeric(10);
Action action = TestHelpers.createAnsibleAction(NOTIFY_CUSTOMER_PROVISION_SUCCESS, envName);
String envName = "cus-" + RandomStringUtils.randomAlphanumeric(5).toLowerCase();
String bitwardenURL = "https://www.example.com";
Action action = TestHelpers.createAnsibleAction(NOTIFY_CUSTOMER_PROVISION_SUCCESS, envName, bitwardenURL);

String result = generateEmailBody(NOTIFY_CUSTOMER_PROVISION_SUCCESS, action);
assertTrue(result.contains(envName));
assertTrue(result.contains(bitwardenURL));
assertTrue(result.contains(TestHelpers.HCC_LOGO_TARGET));
}
}

0 comments on commit b1f2eba

Please sign in to comment.