Story #107 Multiple levels of email opt out - cseseniordesign/reservations GitHub Wiki

End User Documentation

Dev Testing Instructions

  1. If on a dev (local host) environment (i.e. not staging or production), make sure you are using the UNL VPN. This is necessary for emails to send properly. NOTE: several IP addresses have been blocked from sending emails. It is entirely likely that none of the VPN servers will be able to send email. In this case, testing must occur on the staging/production environment.
  2. Navigate to Admin > Users.
  3. Find yourself and click Edit.
  4. Under “Email Preferences,” make sure both the General and Promotional boxes are checked.
  5. Click Update.
  6. Navigate to Admin > Email.
  7. Click Compose.
  8. Select yourself as the only recipient. You can do this by selecting yourself under the Specific User(s) section.
  9. Optional: select one of the preset emails so you don’t have to type anything later.
  10. Click the Select the Email Type: dropdown menu and select Promotional.
  11. Ensure there is text in both the Subject and Body fields.
  12. Double check you are the only selected recipient.
  13. Click Send.
  14. You should have received the email at the address you have listed on your My Account page.
  15. Click the My Account button in the top right corner.
  16. Check the box I no longer want to receive promotional emails from Nebraska Innovation Studio. so you can test the opt-out functionality.
  17. Click Save.
  18. Repeat steps 2-13.
  19. Ensure you did not receive the email. NOTE: you may receive an alert on the page that says "No Users Selected - This email was not sent to any users." This is the desired functionality as it means all the selected users have opted out.
  20. Repeat steps 6-9.
  21. Click the Select the Email Type: dropdown menu and select General.
  22. Repeat steps 11-14.
  23. You should have received the email at the address you have listed on your My Account page.
  24. Navigate to Admin > Users.
  25. Find yourself and click Edit.
  26. Under “Email Preferences,” uncheck the General box.
  27. Check/uncheck the Promotional box.
  28. Click Update.
  29. Make sure the changes are reflected on your My Account page.
  30. Now we will make sure you do not receive General emails after opting out. Repeat steps 6-9.
  31. Click the Select the Email Type: dropdown menu and select General.
  32. Repeat steps 11-13.
  33. Ensure you did not receive the email. NOTE: you may receive an alert on the page that says "No Users Selected - This email was not sent to any users." This is the desired functionality as it means all the selected users have opted out.

Production Testing Instructions

  1. Go to https://innovationstudio-manager.unl.edu/home/
  2. Log in as an admin user, then Follow steps 2-22 from the dev testing instructions above.

Technical Documentation

classes/emailer.rb

  • Associating email types with integer values.
  • Creating type_name method, which returns the email type name.

routes/admin/emails.rb

  • Changes within the POST /admin/email/send/? action:
    • Filtering email receivers based on the composed email type.

routes/admin/users.rb

  • Update the user's email preferences with opt-out checkboxes for each email type.

routes/auth.rb

  • Update the user's email preferences with opt-in checkboxes for each email type.

views/admin/edit_user.erb

  • Creating UI for opt-in checkboxes for each email type.

views/admin/send_email.erb

  • Creating UI for selecting email type for the composed email.

views/me.erb

  • Create a checkbox to opt out of promotional emails.

new_schema.sql

  • adding SQL scripts.