-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[EASI-4529] notification emails #2947
Open
samoddball
wants to merge
12
commits into
feature/EASI-4521_grb_presentation_links
Choose a base branch
from
EASI-4529/notification_emails
base: feature/EASI-4521_grb_presentation_links
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
100f4f5
email template
samoddball 46fec23
create template support code
samoddball 20bde5f
add to tests
samoddball fd84340
Merge branch 'main' of https://github.com/CMS-Enterprise/easi-app int…
samoddball f707d61
use acronym
samoddball c50bbef
Merge branch 'feature/EASI-4521_grb_presentation_links' into EASI-452…
samoddball b9da72a
Merge branch 'feature/EASI-4521_grb_presentation_links' into EASI-452…
samoddball 4c6f6b8
Merge branch 'feature/EASI-4521_grb_presentation_links' into EASI-452…
samoddball 04d01fe
Update pkg/email/templates/grb_review_presentation_links_updated.gohtml
samoddball c8ca659
remove extra <br>
samoddball 551ab2e
updates to system_intake_admin_upload_doc.gohtml
samoddball 22ce298
fix oops
samoddball File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,7 +42,7 @@ type GRBReviewDiscussionIndividualTaggedBody struct { | |
|
||
func (sie systemIntakeEmails) grbReviewDiscussionIndividualTaggedBody(input SendGRBReviewDiscussionIndividualTaggedEmailInput) (string, error) { | ||
if sie.client.templates.grbReviewDiscussionIndividualTagged == nil { | ||
return "", errors.New("grb review discussion reply template is nil") | ||
return "", errors.New("grb review discussion individual tagged template is nil") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed err msg |
||
} | ||
|
||
grbReviewPath := path.Join("it-governance", input.SystemIntakeID.String(), "grb-review") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package email | ||
|
||
import ( | ||
"bytes" | ||
"context" | ||
"errors" | ||
"fmt" | ||
"path" | ||
|
||
"github.com/google/uuid" | ||
|
||
"github.com/cms-enterprise/easi-app/pkg/models" | ||
) | ||
|
||
type SendGRBReviewPresentationLinksUpdatedEmailInput struct { | ||
SystemIntakeID uuid.UUID | ||
ProjectName string | ||
RequesterName string | ||
RequesterComponent string | ||
Recipients []models.EmailAddress | ||
} | ||
|
||
type grbReviewPresentationLinksUpdatedBody struct { | ||
ProjectName string | ||
RequesterName string | ||
RequesterComponent string | ||
SystemIntakeLink string | ||
ITGovernanceInboxAddress models.EmailAddress | ||
} | ||
|
||
func (sie systemIntakeEmails) grbReviewPresentationLinksUpdatedBody(input SendGRBReviewPresentationLinksUpdatedEmailInput) (string, error) { | ||
if sie.client.templates.grbReviewPresentationLinksUpdated == nil { | ||
return "", errors.New("grb review presentation links updated template is nil") | ||
} | ||
|
||
grbReviewPath := path.Join("it-governance", input.SystemIntakeID.String(), "grb-review") | ||
|
||
data := grbReviewPresentationLinksUpdatedBody{ | ||
ProjectName: input.ProjectName, | ||
SystemIntakeLink: sie.client.urlFromPath(grbReviewPath), | ||
RequesterName: input.RequesterName, | ||
RequesterComponent: input.RequesterComponent, | ||
ITGovernanceInboxAddress: sie.client.config.GRTEmail, | ||
} | ||
|
||
var b bytes.Buffer | ||
if err := sie.client.templates.grbReviewPresentationLinksUpdated.Execute(&b, data); err != nil { | ||
return "", err | ||
} | ||
|
||
return b.String(), nil | ||
} | ||
|
||
func (sie systemIntakeEmails) SendGRBReviewPresentationLinksUpdatedEmail(ctx context.Context, input SendGRBReviewPresentationLinksUpdatedEmailInput) error { | ||
subject := fmt.Sprintf("Presentation links updated on the GRB review for %s", input.ProjectName) | ||
|
||
body, err := sie.grbReviewPresentationLinksUpdatedBody(input) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
return sie.client.sender.Send( | ||
ctx, | ||
NewEmail(). | ||
WithToAddresses(input.Recipients). | ||
WithCCAddresses([]models.EmailAddress{sie.client.config.GRTEmail}). | ||
WithSubject(subject). | ||
WithBody(body), | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package email | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"path" | ||
|
||
"github.com/google/uuid" | ||
|
||
"github.com/cms-enterprise/easi-app/pkg/models" | ||
) | ||
|
||
func (s *EmailTestSuite) TestSendGRBReviewPresentationLinksUpdatedEmail() { | ||
ctx := context.Background() | ||
intakeID := uuid.MustParse("24dd7736-e4c2-4f67-8844-51187de49069") | ||
requestName := "Presentation Links" | ||
requester := "Nobody" | ||
requesterComponent := "ABCD" | ||
recipients := []models.EmailAddress{"someone@cms.gov"} | ||
|
||
sender := mockSender{} | ||
client, err := NewClient(s.config, &sender) | ||
s.NoError(err) | ||
|
||
err = client.SystemIntake.SendGRBReviewPresentationLinksUpdatedEmail( | ||
ctx, | ||
SendGRBReviewPresentationLinksUpdatedEmailInput{ | ||
SystemIntakeID: intakeID, | ||
ProjectName: requestName, | ||
RequesterName: requester, | ||
RequesterComponent: requesterComponent, | ||
Recipients: recipients, | ||
}, | ||
) | ||
s.NoError(err) | ||
|
||
expectedSubject := fmt.Sprintf("Presentation links updated on the GRB review for %s", requestName) | ||
s.Equal(expectedSubject, sender.subject) | ||
|
||
s.ElementsMatch(sender.toAddresses, recipients) | ||
s.ElementsMatch(sender.ccAddresses, []models.EmailAddress{s.config.GRTEmail}) | ||
|
||
intakePath := path.Join("it-governance", intakeID.String(), "grb-review") | ||
|
||
grbReviewLink := client.urlFromPath(intakePath) | ||
|
||
expectedEmail := fmt.Sprintf(` | ||
<h1 class="header-title">EASi</h1> | ||
<p class="header-subtitle">Easy Access to System Information</p> | ||
|
||
<p>The Governance Admin Team has updated the presentation recording links on the GRB review for %[1]s. You | ||
may view the recording and/or slide deck using the link below.</p> | ||
|
||
<p><strong><a href="%[2]s">View this request in EASi</a></strong></p> | ||
|
||
<br> | ||
<div class="no-margin"> | ||
<p><strong>Request summary:</strong></p> | ||
<p><strong>Project title:</strong> %[1]s</p> | ||
<p><strong>Requester:</strong> %[3]s, %[4]s</p> | ||
</div> | ||
|
||
<br> | ||
<p>If you have questions, please contact the Governance Team at <a | ||
href="mailto:%[5]s">%[5]s</a>.</p> | ||
<hr> | ||
<p>You will continue to receive email notifications about this request until it is closed.</p>`, | ||
requestName, | ||
grbReviewLink, | ||
requester, | ||
requesterComponent, | ||
s.config.GRTEmail.String(), | ||
) | ||
|
||
s.EqualHTML(expectedEmail, sender.body) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
pkg/email/templates/grb_review_presentation_links_updated.gohtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{{template "easi_header.gohtml"}} | ||
|
||
<p>The Governance Admin Team has updated the presentation recording links on the GRB review for {{.ProjectName}}. You | ||
may view the recording and/or slide deck using the link below.</p> | ||
|
||
<p><strong><a href="{{.SystemIntakeLink}}">View this request in EASi</a></strong></p> | ||
|
||
<br> | ||
<div class="no-margin"> | ||
<p><strong>Request summary:</strong></p> | ||
<p><strong>Project title:</strong> {{.ProjectName}}</p> | ||
<p><strong>Requester:</strong> {{.RequesterName}}, {{.RequesterComponent}}</p> | ||
</div> | ||
|
||
<br> | ||
<p>If you have questions, please contact the Governance Team at <a | ||
href="mailto:{{.ITGovernanceInboxAddress}}">{{.ITGovernanceInboxAddress}}</a>.</p> | ||
<hr> | ||
<p>You will continue to receive email notifications about this request until it is closed.</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed err msg