-
-
Notifications
You must be signed in to change notification settings - Fork 537
Email volunteers when their reimbursement request is marked complete #7056
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
Open
arielsalcepk
wants to merge
6
commits into
rubyforgood:main
Choose a base branch
from
arielsalcepk:7041-reimbursement-email-notification
base: main
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 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
cd988cd
Email volunteers when their reimbursement request is marked complete …
arielsalcepk 6d73a57
Fix standardrb/erb_lint formatting
arielsalcepk 97cb25f
Clean up comment formatting and document reimbursement_complete_email…
arielsalcepk 4d772ca
Remove stray blank line before reimbursement_complete_email preview c…
arielsalcepk f07b326
Fix currency regex and skip notification when reimbursement is unchecked
arielsalcepk 80f3c23
Add regression tests for regex escaping and unchecked reimbursements
arielsalcepk 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 hidden or 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 hidden or 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
29 changes: 29 additions & 0 deletions
29
app/views/volunteer_mailer/reimbursement_complete_email.html.erb
This file contains hidden or 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,29 @@ | ||
| <meta itemprop="name" content="Reimbursement Processed" style="font-family: Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;"> | ||
| <style>/* Email styles need to be inline */</style> | ||
| <table width="100%" cellpadding="0" cellspacing="0" style="font-family: Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;"> | ||
| <tr style="font-family: Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;"> | ||
| <td class="content-block" style="font-family: Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 0 0 20px;" valign="top"> | ||
| Hello <%= @user.display_name %>, | ||
| </td> | ||
| </tr> | ||
| <tr style="font-family: Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;"> | ||
| <td class="content-block" style="font-family: Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 0 0 20px;" valign="top"> | ||
| Your reimbursement request for <%= @case_contact.miles_driven %>mi | ||
| <% if @case_contact.reimbursement_amount %> | ||
| (<%= number_to_currency(@case_contact.reimbursement_amount) %>) | ||
| <% end %> | ||
| on <%= @case_contact.occurred_at_display %> has been processed and is en route. | ||
| </td> | ||
| </tr> | ||
| <tr style="font-family: Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;"> | ||
| <td class="content-block" style="font-family: Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 0 0 20px;" valign="top"> | ||
| You can view your case contacts and their reimbursement status by visiting | ||
| <a href="<%= "#{case_contacts_url(casa_case_id: @case_contact.casa_case_id)}" %>" target="_blank">this link</a>. | ||
| </td> | ||
| </tr> | ||
| <tr style="font-family: Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;"> | ||
| <td class="content-block" style="font-family: Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 0 0 20px;" valign="top"> | ||
| If you have any questions, please contact your most recent CASA supervisor for assistance. | ||
| </td> | ||
| </tr> | ||
| </table> |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
I think this is going to catch any string consider $ is a regex end-anchor. Think you may need to use something like match(/$[\d,]+.\d{2}/)
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.
@Jberma23 Fixed both, thanks for catching these, and here's what changed for a brief summary (although please do check this further):
Almost used your regex as is, just had to escape $ and . as well, otherwise those are the end-of-line anchor and any-character wildcard, not literal characters. And the test now uses: /$[\d,]+.\d{2}/. 👍
Controller now guards the notifier call with ActiveModel::Type::Boolean.new.cast(reimbursement_complete), so unchecking no longer fires it. Worth noting: that bug predates this PR, was harmless before as an in-app-only notification, but our email delivery is what made it consequential. This PR successfully both exposed and fixed it, specially thanks to your call out!
Added tests covering both directions and value formats, plus the no-mileage-rate case.