Feature/1885 Give user the ability to customise which SMS notifications they want to receive#3543
Conversation
|
what's up with all those model file changes? |
Just ran the migrations after pulling in |
There was a problem hiding this comment.
Awesome, this is great! Always increasing my RoR arsenal when reviewing your PRs. Also wanted an extra explanation on users and sms_notification_events many:many relationship. I read https://medium.com/@pk60905/many-to-many-relationship-in-rails-cf86e12db8b0 but want to understand more on why it helps for this specific case
| <%= form.collection_check_boxes("sms_notification_event_ids", SmsNotificationEvent.where(user_type: @user.type), | ||
| :id, :name) do |event| %> | ||
| <div class="form-check"> | ||
| <%= event.check_box(class: "form-check-input", id: "toggle-sms-notification-event") %> |
There was a problem hiding this comment.
This is looking ahead but as the number of notification events grow adding a drop-down/collapse menu could be good at some point. Probably in the same vein as password confirms dropdown. Checkbox is ticked → menus drops down with event checkboxes. checkbox is unticked → menu collapses
|
Events aren't displaying on the edit profile page on my end even after ticking "Text Me". Still unsure why. I'm on the clone branch, |
I think you will have to re-seed the database as well to populate the events data. |
| # updated_at :datetime not null | ||
| # supervisor_id :integer not null | ||
| # volunteer_id :integer not null | ||
| # supervisor_id :bigint not null |
There was a problem hiding this comment.
so confused why they changed from int to bigint.
There was a problem hiding this comment.
I think it's a local version difference with postgres maybe - bigint is arguably more correct.
xihai01
left a comment
There was a problem hiding this comment.
late to the party, but great stuff!
What github issue is this PR for, if any?
Resolves #1885
What changed, and why?
Created
sms_notification_eventstable to store events that users can opt into for SMS notificationsCreated
user_sms_notification_eventstable to create many:many relationship betweenuserstable andsms_notification_eventstableRendered the events below "Text Me" option of edit profile
Create an
sms_notification_event_populatorfor seeding and prod dbEvents Added
Volunteer
Supervisor
CASA Admin
How will this affect user permissions?
How is this tested? (please write tests!) 💖💪
user_sms_notification_eventstable is updated correctly upon user selecting an eventScreenshots please :)