-
Notifications
You must be signed in to change notification settings - Fork 57
Conversation
The default e-mails that are set when we run |
<%= render html: simple_format(replace_variables(@app_configs.upcoming_checkin_email_body)).gsub('\n', '').html_safe %> |
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.
This seems a bit excessive (the gsub
) - we should just make sure that our default bodies don't have \n
in them so that they don't show up for fresh instances. If an admin wants to put "\n" somewhere in their e-mails, we should let them.
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.
The gsub
is necessary because simple_format
converts \n
s to html linebreaks but does not remove them. I'm not sure how to handle it otherwise, unless there's another way of storing linebreaks in our defaults.
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 suppose I could just write our defaults in html and skip the gsub
and simple_format
?
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.
Not necessary, just replace the \n
's with actual line breaks... simple 😄. We still need simple_format
since we need to allow admins to enter their own copy, but we can definitely skip the gsub
.
@@ -9,21 +9,26 @@ class UserMailer < ActionMailer::Base | |||
end | |||
|
|||
# checks the status of the current reservation and sends the appropriate email | |||
# receipt forces a check out receipt to be sent | |||
def reservation_status_update(reservation, receipt = false) # rubocop:disable all | |||
# force forces a check out receipt to be sent OR an approved request email, |
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'm not thrilled with this; it's making the method a little difficult to understand and definitely makes it tricky to modify in the future. Here's an alternative suggestion - default force
to an empty string and use that as a forced @status
(allowing you to send any of the pre-defined statuses, overriding the current status). Therefore to send a receipt you'd call reservation_status_update(res, 'receipt')
and to send the approval e-mail you'd call reservation_status_update(res, 'request approved')
. Obviously you'd need some logic to infer from receipt
whether nor not it was the checkout or checkin receipt, but this to me seems cleaner. Thoughts?
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.
This sounds much better!
Looks pretty good overall, just a few comments above. In terms of the modification to |
Okay, so the only thing that should be left is determining the best way of handling linebreaks in our email messages -- I left a reply above |
Ok, so based on some tinkering locally you should be able to simply edit the default text and replace |
okay, should be good now! |
|
||
return if !receipt && @status == 'returned' && @reservation.overdue && | ||
@reservation.equipment_model.late_fee == 0 | ||
VALID_STATUSES = ['checked out', 'denied', 'due today', 'missed', 'overdue', |
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.
Sorry to nitpick, but let's replace this with a %w()
literal instead; I believe that's the preference in the style guide.
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.
Oh yeah, forgot about that haha; I'm sort of surprised that rubocop doesn't check for that
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.
Yea, I'm not sure why the build passed... maybe b/c it spans multiple lines?
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.
Note that this was reverted since we have strings that include spaces within the array.
Ok, basically there. Let's update the array of valid statuses to use the If you want to try and tackle the integration test, feel free, otherwise get those two changes in and we can squash 😄. |
I'll just fix the two smaller changes for now--if I had a bit more time, I'd do the integration test, but I'd rather not leave this hanging any longer |
9463971
to
86ec173
Compare
|
||
return if !receipt && @status == 'returned' && @reservation.overdue && | ||
@reservation.equipment_model.late_fee == 0 | ||
VALID_STATUSES = %w(checked\ out denied due\ today missed overdue |
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.
Ohh... that's probably why Rubocop didn't complain; some of the strings have spaces in them. Sorry, let's revert this and go back to using brackets (my bad!).
Ok, sorry for the confusion. Just change the array back to a traditional bracketed array and squash your commits. I'll deal with the integration test in #1223. |
86ec173
to
be9efd5
Compare
okay, done! |
@esoterik 🚨 😞 |
argh rubocop... |
be9efd5
to
f227089
Compare
should be actually good to go now |
@equipment_list@ | ||
|
||
If you fail to return your equipment on time you will be subject to a late fee of @late_fee@ per day. If you have lost the item you may additionally have to pay a replacement fee of @replacement_fee@. | ||
Log in to Reservations to see if any of your items are eligible for renewal. If you have further questions feel free to contact an employee of @department_name@. |
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 feel like we could use an extra line break here and above.
Alright this is good to go. I'm just going to add two line breaks to the default check-in and checkout today files and deal with the annoying |
Resolves #1240 - test emails for approved requests that start today - fixed issue with emails for approved requests that start today - delete extra space from user email subject - remove doubled salutations - changed admin mailer from address - fix default emails - rework of user email method
f227089
to
c9ee647
Compare
For future reference, I removed the pesky
The commands I used were (thanks SO):
|
@esoterik scratch that, I'm just adding it to the CHANGELOG myself. Thanks! |
Resolves #1240
I'm not 100% sure that I handled the admin reply-to / from issue in the best way (and it was a bit difficult to test), but I'm pretty sure this works.