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

HER-59-notify-speaker-of-booking-modification #63

Merged
merged 3 commits into from
Jan 19, 2025

Conversation

dewi-anggraini
Copy link
Collaborator

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

  • [v] I have documented my code with code comments.

Copy link
Collaborator

@trca831 trca831 left a comment

Choose a reason for hiding this comment

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

LGTM

@dewi-anggraini dewi-anggraini merged commit ab3f4c7 into main Jan 19, 2025
3 checks passed
@dewi-anggraini dewi-anggraini deleted the HER-59-notify-speaker-of-booking-modification branch January 19, 2025 01:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants