Skip to content
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

Feature/1886 Volunteer receives SMS to notify of follow up generated by admin or supervisor #3738

Merged
merged 12 commits into from
Jul 8, 2022

Conversation

7riumph
Copy link
Collaborator

@7riumph 7riumph commented Jul 6, 2022

What github issue is this PR for, if any?

Resolves #1886

What changed, and why?

Admins and Supervisors can send SMS messages to notify volunteers about case contact follow-ups

  • Added delivery_methods/sms.rb to followup_notification.rb
  • Required preferences sms_notifications? and email_notifications? before corresponding deliveries
  • Created valid_phone_number_if_receive_sms_notifications to ensure users add a phone number that will receive SMSs
  • Used SmsBodyHelper to store message bodies

How will this affect user permissions?

  • Volunteer permissions: n/a
  • Supervisor permissions: Can now send follow-up SMS notifications
  • Admin permissions: Can now send follow-up SMS notifications

How is this tested? (please write tests!) 💖💪

Previous tests:

Follow-up tests → spec/system/users/edit_spec.rb
Twilio delivery tests → spec/services/twilio_service_spec.rb
Short.io tests → spec/services/short_url_service_spec.rb

New test:
Ensure a valid phone number is required before users select the receive SMS preference → edit_spec.rb

Removed tests in:

→ spec/lib/tasks/case_contact_types_reminder_spec.rb
→ spec/lib/tasks/no_contact_made_reminder_spec.rb

They were removed because Volunteers can no longer have the SMS preference without first adding a phone number

Screenshots please :)

send-followup-sms.mov

@github-actions github-actions bot added ruby Pull requests that update Ruby code Tests! 🎉💖👏 labels Jul 6, 2022
…ave a phone number if sms preference is picked)
@7riumph 7riumph changed the title Feature/1886 Feature/1886 Volunteer receives SMS to notify of follow up generated by admin or supervisor Jul 6, 2022
@@ -60,6 +60,7 @@ notifications/base_notification.rb
notifications/followup_notification.rb
notifications/followup_resolved_notification.rb
notifications/youth_birthday_notification.rb
notifications/delivery_methods/sms.rb
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ideally let's not add to the skipped tests file

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For sure. I'm beginning to figure out how this could be tested, which will hopefully lay the groundwork for testing the other notifications in .allow_skipping_tests

@@ -7,7 +7,8 @@ class FollowupNotification < BaseNotification
# Add your delivery methods
#
deliver_by :database
# deliver_by :email, mailer: "UserMailer"
# deliver_by :email, mailer: "UserMailer", if: :email_notifications?
# deliver_by :sms, class: "DeliveryMethods::Sms", if: :sms_notifications?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this supposed to be commented out?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the email one was commented out when I started this. https://github.com/rubyforgood/casa/pull/1612/files is the email and database pr

Copy link
Collaborator Author

@7riumph 7riumph Jul 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also the "noticed gem" was first added here #1611

@compwron compwron marked this pull request as ready for review July 8, 2022 06:35
@compwron compwron merged commit 9b7dee8 into rubyforgood:main Jul 8, 2022
@7riumph 7riumph added 📱 SMS work relating to SMS notifications #1017 codethechange for codethechange developers labels Jul 8, 2022
@7riumph 7riumph self-assigned this Aug 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
codethechange for codethechange developers 📱 SMS work relating to SMS notifications #1017 ruby Pull requests that update Ruby code Tests! 🎉💖👏
Projects
None yet
Development

Successfully merging this pull request may close these issues.

volunteer receives SMS to notify of follow up generated by admin or supervisor
2 participants