HER-59-notify-speaker-of-booking-modification #63
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.
HER-59 Notify Speaker Of Booking Modification
Issue
https://raquelanaroman.atlassian.net/browse/HER-59
Description
As a speaker, I want to be notified when a booking request is modified so that I am aware of any changes to my schedule.
Acceptance Criteria
When a booking request is modified, the speaker should receive an email notification about the changes.
The email should include details of the booking.
Update the BookingsController to send a notification email to the speaker when a booking is modified.
#49
#36
#60
Changes
Implementation
Add a method in the BookingMailer to handle the notification email.
def booking_modified_notification(speaker, booking)
@speaker = speaker
@booking = booking
@location = @booking.user.organization.address
mail(to: @speaker.email, subject: 'Booking Request Modified')
end
Update the update action in the BookingsController to send the notification email when a booking is modified.
def update
if @booking.status == 'pending'
if @booking.update(booking_params)
BookingMailer.booking_modified_notification(@booking.speaker, @booking).deliver_now
render json: @booking
else
render json: @booking.errors, status: :unprocessable_entity
end
else
render json: { error: 'Booking cannot be modified once it is accepted or declined.'}, status: :unprocessable_entity
end
end
Ensure that when a booking is modified, the speaker receives an email with the updated booking details.
Review Checklist