VRFS-1668 email notifications for scheduled sessions
This commit is contained in:
parent
8fc30baf42
commit
0b2acda11e
|
|
@ -218,31 +218,176 @@
|
|||
end
|
||||
end
|
||||
|
||||
def scheduled_session_invitation(email, msg, session_id)
|
||||
def scheduled_session_invitation(email, msg, session)
|
||||
subject = "Session Invitation"
|
||||
unique_args = {:type => "scheduled_session_invitation"}
|
||||
@body = msg
|
||||
@session_name = session.description
|
||||
@session_date = session.scheduled_start
|
||||
@session_url = "#{APP_CONFIG.external_root_url}/sessions/#{session.id}/details"
|
||||
sendgrid_category "Notification"
|
||||
sendgrid_unique_args :type => unique_args[:type]
|
||||
|
||||
sendgrid_recipients([email])
|
||||
sendgrid_substitute('@USERID', [User.id_for_email(email)])
|
||||
|
||||
mail(:to => email, :subject => subject) do |format|
|
||||
format.text
|
||||
format.html
|
||||
end
|
||||
end
|
||||
|
||||
def scheduled_session_rsvp(email, msg)
|
||||
def scheduled_session_rsvp(email, msg, session)
|
||||
subject = "Session RSVP"
|
||||
unique_args = {:type => "scheduled_session_rsvp"}
|
||||
@body = msg
|
||||
@session_name = session.description
|
||||
@session_date = session.scheduled_start
|
||||
@session_url = "#{APP_CONFIG.external_root_url}/sessions/#{session.id}/details"
|
||||
sendgrid_category "Notification"
|
||||
sendgrid_unique_args :type => unique_args[:type]
|
||||
|
||||
sendgrid_recipients([email])
|
||||
sendgrid_substitute('@USERID', [User.id_for_email(email)])
|
||||
|
||||
mail(:to => email, :subject => subject) do |format|
|
||||
format.text
|
||||
format.html
|
||||
end
|
||||
end
|
||||
|
||||
def scheduled_session_rsvp_approved(email, msg)
|
||||
def scheduled_session_rsvp_approved(email, msg, session)
|
||||
subject = "Session RSVP Approved"
|
||||
unique_args = {:type => "scheduled_session_rsvp_approved"}
|
||||
@body = msg
|
||||
@session_name = session.description
|
||||
@session_date = session.scheduled_start
|
||||
@session_url = "#{APP_CONFIG.external_root_url}/sessions/#{session.id}/details"
|
||||
sendgrid_category "Notification"
|
||||
sendgrid_unique_args :type => unique_args[:type]
|
||||
|
||||
sendgrid_recipients([email])
|
||||
sendgrid_substitute('@USERID', [User.id_for_email(email)])
|
||||
|
||||
mail(:to => email, :subject => subject) do |format|
|
||||
format.text
|
||||
format.html
|
||||
end
|
||||
end
|
||||
|
||||
def scheduled_session_rsvp_cancelled(email, msg)
|
||||
def scheduled_session_rsvp_cancelled(email, msg, session)
|
||||
subject = "Session RSVP Cancelled"
|
||||
unique_args = {:type => "scheduled_session_rsvp_cancelled"}
|
||||
@body = msg
|
||||
@session_name = session.description
|
||||
@session_date = session.scheduled_start
|
||||
@session_url = "#{APP_CONFIG.external_root_url}/sessions/#{session.id}/details"
|
||||
sendgrid_category "Notification"
|
||||
sendgrid_unique_args :type => unique_args[:type]
|
||||
|
||||
sendgrid_recipients([email])
|
||||
sendgrid_substitute('@USERID', [User.id_for_email(email)])
|
||||
|
||||
mail(:to => email, :subject => subject) do |format|
|
||||
format.text
|
||||
format.html
|
||||
end
|
||||
end
|
||||
|
||||
def scheduled_session_rsvp_cancelled_org(email, msg)
|
||||
def scheduled_session_rsvp_cancelled_org(email, msg, session)
|
||||
subject = "Your Session RSVP Cancelled"
|
||||
unique_args = {:type => "scheduled_session_rsvp_cancelled_org"}
|
||||
@body = msg
|
||||
@session_name = session.description
|
||||
@session_date = session.scheduled_start
|
||||
@session_url = "#{APP_CONFIG.external_root_url}/sessions/#{session.id}/details"
|
||||
sendgrid_category "Notification"
|
||||
sendgrid_unique_args :type => unique_args[:type]
|
||||
|
||||
sendgrid_recipients([email])
|
||||
sendgrid_substitute('@USERID', [User.id_for_email(email)])
|
||||
|
||||
mail(:to => email, :subject => subject) do |format|
|
||||
format.text
|
||||
format.html
|
||||
end
|
||||
end
|
||||
|
||||
def scheduled_session_cancelled(email, msg)
|
||||
def scheduled_session_cancelled(email, msg, session)
|
||||
subject = "Session Cancelled"
|
||||
unique_args = {:type => "scheduled_session_cancelled"}
|
||||
@body = msg
|
||||
@session_name = session.description
|
||||
@session_date = session.scheduled_start
|
||||
@session_url = "#{APP_CONFIG.external_root_url}/sessions/#{session.id}/details"
|
||||
sendgrid_category "Notification"
|
||||
sendgrid_unique_args :type => unique_args[:type]
|
||||
|
||||
sendgrid_recipients([email])
|
||||
sendgrid_substitute('@USERID', [User.id_for_email(email)])
|
||||
|
||||
mail(:to => email, :subject => subject) do |format|
|
||||
format.text
|
||||
format.html
|
||||
end
|
||||
end
|
||||
|
||||
def scheduled_session_rescheduled(email, msg)
|
||||
def scheduled_session_rescheduled(email, msg, session)
|
||||
subject = "Session Rescheduled"
|
||||
unique_args = {:type => "scheduled_session_rescheduled"}
|
||||
@body = msg
|
||||
@session_name = session.description
|
||||
@session_date = session.scheduled_start
|
||||
@session_url = "#{APP_CONFIG.external_root_url}/sessions/#{session.id}/details"
|
||||
sendgrid_category "Notification"
|
||||
sendgrid_unique_args :type => unique_args[:type]
|
||||
|
||||
sendgrid_recipients([email])
|
||||
sendgrid_substitute('@USERID', [User.id_for_email(email)])
|
||||
|
||||
mail(:to => email, :subject => subject) do |format|
|
||||
format.text
|
||||
format.html
|
||||
end
|
||||
end
|
||||
|
||||
def scheduled_session_reminder(email, msg)
|
||||
def scheduled_session_reminder(email, msg, session)
|
||||
subject = "Session Rescheduled"
|
||||
unique_args = {:type => "scheduled_session_reminder"}
|
||||
@body = msg
|
||||
@session_name = session.description
|
||||
@session_date = session.scheduled_start
|
||||
@session_url = "#{APP_CONFIG.external_root_url}/sessions/#{session.id}/details"
|
||||
sendgrid_category "Notification"
|
||||
sendgrid_unique_args :type => unique_args[:type]
|
||||
|
||||
sendgrid_recipients([email])
|
||||
sendgrid_substitute('@USERID', [User.id_for_email(email)])
|
||||
|
||||
mail(:to => email, :subject => subject) do |format|
|
||||
format.text
|
||||
format.html
|
||||
end
|
||||
end
|
||||
|
||||
def scheduled_session_comment(email, msg)
|
||||
def scheduled_session_comment(email, msg, comment, session)
|
||||
subject = "New Session Comment"
|
||||
unique_args = {:type => "scheduled_session_comment"}
|
||||
@body = msg
|
||||
@session_name = session.description
|
||||
@session_date = session.scheduled_start
|
||||
@comment = comment
|
||||
@session_url = "#{APP_CONFIG.external_root_url}/sessions/#{session.id}/details"
|
||||
sendgrid_category "Notification"
|
||||
sendgrid_unique_args :type => unique_args[:type]
|
||||
|
||||
sendgrid_recipients([email])
|
||||
sendgrid_substitute('@USERID', [User.id_for_email(email)])
|
||||
|
||||
mail(:to => email, :subject => subject) do |format|
|
||||
format.text
|
||||
format.html
|
||||
end
|
||||
end
|
||||
|
||||
def band_session_join(email, msg, session_id)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
<% provide(:title, 'Scheduled Session Cancelled') %>
|
||||
|
||||
<p><%= @body %></p>
|
||||
|
||||
<p><a style="color: #588C98;" href="<%= @session_url %>">View Session Details</a></p>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<%= @body %>
|
||||
|
||||
<%= @session_name %>
|
||||
<%= @session_date %>
|
||||
|
||||
See session details at <%= @session_url %>.
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<% provide(:title, 'Scheduled Session Comment') %>
|
||||
|
||||
<p><%= @body %></p>
|
||||
|
||||
<p><%= @comment %></p>
|
||||
|
||||
<p><a style="color: #588C98;" href="<%= @session_url %>">View Session Details</a></p>
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
<%= @body %>
|
||||
|
||||
<%= @session_name %>
|
||||
<%= @session_date %>
|
||||
|
||||
<%= @comment %>
|
||||
|
||||
See session details at <%= @session_url %>.
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
<% provide(:title, 'Scheduled Session Invitation') %>
|
||||
|
||||
<p><%= @body %></p>
|
||||
|
||||
<p>
|
||||
<%= @session_name %><br/>
|
||||
<%= @session_date %>
|
||||
</p>
|
||||
|
||||
<p><a style="color: #588C98;" href="<%= @session_url %>">View Session Details</a></p>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<%= @body %>
|
||||
|
||||
<%= @session_name %>
|
||||
<%= @session_date %>
|
||||
|
||||
See session details at <%= @session_url %>.
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
<% provide(:title, 'Scheduled Session Reminder') %>
|
||||
|
||||
<p><%= @body %></p>
|
||||
|
||||
<p>
|
||||
<%= @session_name %><br/>
|
||||
<%= @session_date %>
|
||||
</p>
|
||||
|
||||
<p><a style="color: #588C98;" href="<%= @session_url %>">View Session Details</a></p>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<%= @body %>
|
||||
|
||||
<%= @session_name %>
|
||||
<%= @session_date %>
|
||||
|
||||
See session details at <%= @session_url %>.
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
<% provide(:title, 'Scheduled Session Reschedule') %>
|
||||
|
||||
<p><%= @body %></p>
|
||||
|
||||
<p>
|
||||
<%= @session_name %><br/>
|
||||
<%= @session_date %>
|
||||
</p>
|
||||
|
||||
<p><a style="color: #588C98;" href="<%= @session_url %>">View Session Details</a></p>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<%= @body %>
|
||||
|
||||
<%= @session_name %>
|
||||
<%= @session_date %>
|
||||
|
||||
See session details at <%= @session_url %>.
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
<% provide(:title, 'Scheduled Session RSVP') %>
|
||||
|
||||
<p><%= @body %></p>
|
||||
|
||||
<p>
|
||||
<%= @session_name %><br/>
|
||||
<%= @session_date %>
|
||||
</p>
|
||||
|
||||
<p><a style="color: #588C98;" href="<%= @session_url %>">View Session Details</a></p>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<%= @body %>
|
||||
|
||||
<%= @session_name %>
|
||||
<%= @session_date %>
|
||||
|
||||
See session details at <%= @session_url %>.
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
<% provide(:title, 'Scheduled Session RSVP Approved') %>
|
||||
|
||||
<p><%= @body %></p>
|
||||
|
||||
<p>
|
||||
<%= @session_name %><br/>
|
||||
<%= @session_date %>
|
||||
</p>
|
||||
|
||||
<p><a style="color: #588C98;" href="<%= @session_url %>">View Session Details</a></p>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<%= @body %>
|
||||
|
||||
<%= @session_name %>
|
||||
<%= @session_date %>
|
||||
|
||||
See session details at <%= @session_url %>.
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
<% provide(:title, 'Scheduled Session RSVP Cancelled') %>
|
||||
|
||||
<p><%= @body %></p>
|
||||
|
||||
<p>
|
||||
<%= @session_name %><br/>
|
||||
<%= @session_date %>
|
||||
</p>
|
||||
|
||||
<p><a style="color: #588C98;" href="<%= @session_url %>">View Session Details</a></p>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<%= @body %>
|
||||
|
||||
<%= @session_name %>
|
||||
<%= @session_date %>
|
||||
|
||||
See session details at <%= @session_url %>.
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
<% provide(:title, 'Scheduled Session RSVP Cancelled By Organizer') %>
|
||||
|
||||
<p><%= @body %></p>
|
||||
|
||||
<p>
|
||||
<%= @session_name %><br/>
|
||||
<%= @session_date %>
|
||||
</p>
|
||||
|
||||
<p><a style="color: #588C98;" href="<%= @session_url %>">View Session Details</a></p>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<%= @body %>
|
||||
|
||||
<%= @session_name %>
|
||||
<%= @session_date %>
|
||||
|
||||
See session details at <%= @session_url %>.
|
||||
|
|
@ -188,19 +188,19 @@ module JamRuby
|
|||
return "A musician has cancelled an RSVP to your session."
|
||||
|
||||
when NotificationTypes::SCHEDULED_SESSION_RSVP_CANCELLED_ORG
|
||||
return "The session organizer has cancelled this session:"
|
||||
return "The session organizer has cancelled your RSVP to this session."
|
||||
|
||||
when NotificationTypes::SCHEDULED_SESSION_CANCELLED
|
||||
return "The session organizer has cancelled this session:"
|
||||
return "The session organizer has cancelled this session."
|
||||
|
||||
when NotificationTypes::SCHEDULED_SESSION_RESCHEDULED
|
||||
return "The following session has been rescheduled:"
|
||||
return "The following session has been rescheduled."
|
||||
|
||||
when NotificationTypes::SCHEDULED_SESSION_REMINDER
|
||||
return "A session to which you have RSVPd will begin in one hour, so get ready to play!"
|
||||
|
||||
when NotificationTypes::SCHEDULED_SESSION_COMMENT
|
||||
return "New message about session:"
|
||||
return "New message about session."
|
||||
|
||||
# recording notifications
|
||||
when NotificationTypes::MUSICIAN_RECORDING_SAVED
|
||||
|
|
@ -589,18 +589,26 @@ module JamRuby
|
|||
|
||||
notification_msg = format_msg(notification.description, {:user => source_user, :session => music_session})
|
||||
|
||||
msg = @@message_factory.scheduled_session_invitation(
|
||||
target_user.id,
|
||||
music_session.id,
|
||||
source_user.photo_url,
|
||||
notification_msg,
|
||||
music_session.description,
|
||||
music_session.scheduled_start,
|
||||
notification.id,
|
||||
notification.created_date
|
||||
)
|
||||
if target_user.online
|
||||
msg = @@message_factory.scheduled_session_invitation(
|
||||
target_user.id,
|
||||
music_session.id,
|
||||
source_user.photo_url,
|
||||
notification_msg,
|
||||
music_session.description,
|
||||
music_session.scheduled_start,
|
||||
notification.id,
|
||||
notification.created_date
|
||||
)
|
||||
|
||||
@@mq_router.publish_to_user(target_user.id, msg)
|
||||
@@mq_router.publish_to_user(target_user.id, msg)
|
||||
else
|
||||
begin
|
||||
UserMailer.scheduled_session_invitation(target_user.email, notification_msg, music_session).deliver
|
||||
rescue => e
|
||||
@@log.error("Unable to send scheduled_session_invitation email to offline user #{target_user.email} #{e}")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def send_scheduled_session_rsvp(music_session, user, instruments)
|
||||
|
|
@ -616,20 +624,28 @@ module JamRuby
|
|||
|
||||
notification_msg = format_msg(notification.description, {:user => source_user, :session => music_session})
|
||||
|
||||
msg = @@message_factory.scheduled_session_rsvp(
|
||||
target_user.id,
|
||||
music_session.id,
|
||||
source_user.photo_url,
|
||||
notification_msg,
|
||||
source_user.id,
|
||||
instruments,
|
||||
music_session.description,
|
||||
music_session.scheduled_start,
|
||||
notification.id,
|
||||
notification.created_date
|
||||
)
|
||||
if target_user.online
|
||||
msg = @@message_factory.scheduled_session_rsvp(
|
||||
target_user.id,
|
||||
music_session.id,
|
||||
source_user.photo_url,
|
||||
notification_msg,
|
||||
source_user.id,
|
||||
instruments,
|
||||
music_session.description,
|
||||
music_session.scheduled_start,
|
||||
notification.id,
|
||||
notification.created_date
|
||||
)
|
||||
|
||||
@@mq_router.publish_to_user(target_user.id, msg)
|
||||
@@mq_router.publish_to_user(target_user.id, msg)
|
||||
else
|
||||
begin
|
||||
UserMailer.scheduled_session_rsvp(target_user.email, notification_msg, music_session).deliver
|
||||
rescue => e
|
||||
@@log.error("Unable to send scheduled_session_rsvp email to offline user #{target_user.email} #{e}")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def send_scheduled_session_rsvp_approved(music_session, user)
|
||||
|
|
@ -645,17 +661,25 @@ module JamRuby
|
|||
|
||||
notification_msg = format_msg(notification.description, {:session => music_session})
|
||||
|
||||
msg = @@message_factory.scheduled_session_rsvp_approved(
|
||||
target_user.id,
|
||||
music_session.id,
|
||||
notification_msg,
|
||||
music_session.description,
|
||||
music_session.scheduled_start,
|
||||
notification.id,
|
||||
notification.created_date
|
||||
)
|
||||
if target_user.online
|
||||
msg = @@message_factory.scheduled_session_rsvp_approved(
|
||||
target_user.id,
|
||||
music_session.id,
|
||||
notification_msg,
|
||||
music_session.description,
|
||||
music_session.scheduled_start,
|
||||
notification.id,
|
||||
notification.created_date
|
||||
)
|
||||
|
||||
@@mq_router.publish_to_user(target_user.id, msg)
|
||||
@@mq_router.publish_to_user(target_user.id, msg)
|
||||
else
|
||||
begin
|
||||
UserMailer.scheduled_session_rsvp_approved(target_user.email, notification_msg, music_session).deliver
|
||||
rescue => e
|
||||
@@log.error("Unable to send scheduled_session_rsvp_approved email to offline user #{target_user.email} #{e}")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def send_scheduled_session_rsvp_cancelled(music_session, user)
|
||||
|
|
@ -671,17 +695,25 @@ module JamRuby
|
|||
|
||||
notification_msg = format_msg(notification.description, {:session => music_session})
|
||||
|
||||
msg = @@message_factory.scheduled_session_rsvp_cancelled(
|
||||
target_user.id,
|
||||
music_session.id,
|
||||
notification_msg,
|
||||
music_session.description,
|
||||
music_session.scheduled_start,
|
||||
notification.id,
|
||||
notification.created_date
|
||||
)
|
||||
if target_user.online
|
||||
msg = @@message_factory.scheduled_session_rsvp_cancelled(
|
||||
target_user.id,
|
||||
music_session.id,
|
||||
notification_msg,
|
||||
music_session.description,
|
||||
music_session.scheduled_start,
|
||||
notification.id,
|
||||
notification.created_date
|
||||
)
|
||||
|
||||
@@mq_router.publish_to_user(target_user.id, msg)
|
||||
@@mq_router.publish_to_user(target_user.id, msg)
|
||||
else
|
||||
begin
|
||||
UserMailer.send_scheduled_session_rsvp_cancelled(target_user.email, notification_msg, music_session).deliver
|
||||
rescue => e
|
||||
@@log.error("Unable to send send_scheduled_session_rsvp_cancelled email to offline user #{target_user.email} #{e}")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def send_scheduled_session_rsvp_cancelled_org(music_session, user)
|
||||
|
|
@ -697,17 +729,25 @@ module JamRuby
|
|||
|
||||
notification_msg = format_msg(notification.description, {:session => music_session})
|
||||
|
||||
msg = @@message_factory.scheduled_session_rsvp_cancelled_org(
|
||||
target_user.id,
|
||||
music_session.id,
|
||||
notification_msg,
|
||||
music_session.description,
|
||||
music_session.scheduled_start,
|
||||
notification.id,
|
||||
notification.created_date
|
||||
)
|
||||
if target_user.online
|
||||
msg = @@message_factory.scheduled_session_rsvp_cancelled_org(
|
||||
target_user.id,
|
||||
music_session.id,
|
||||
notification_msg,
|
||||
music_session.description,
|
||||
music_session.scheduled_start,
|
||||
notification.id,
|
||||
notification.created_date
|
||||
)
|
||||
|
||||
@@mq_router.publish_to_user(target_user.id, msg)
|
||||
@@mq_router.publish_to_user(target_user.id, msg)
|
||||
else
|
||||
begin
|
||||
UserMailer.scheduled_session_rsvp_cancelled_org(target_user.email, notification_msg, music_session).deliver
|
||||
rescue => e
|
||||
@@log.error("Unable to send scheduled_session_rsvp_cancelled_org email to offline user #{target_user.email} #{e}")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def send_scheduled_session_cancelled(music_session)
|
||||
|
|
@ -726,17 +766,25 @@ module JamRuby
|
|||
|
||||
notification_msg = format_msg(notification.description, {:session => music_session})
|
||||
|
||||
msg = @@message_factory.scheduled_session_cancelled(
|
||||
target_user.id,
|
||||
music_session.id,
|
||||
notification_msg,
|
||||
music_session.description,
|
||||
music_session.scheduled_start,
|
||||
notification.id,
|
||||
notification.created_date
|
||||
)
|
||||
if target_user.online
|
||||
msg = @@message_factory.scheduled_session_cancelled(
|
||||
target_user.id,
|
||||
music_session.id,
|
||||
notification_msg,
|
||||
music_session.description,
|
||||
music_session.scheduled_start,
|
||||
notification.id,
|
||||
notification.created_date
|
||||
)
|
||||
|
||||
@@mq_router.publish_to_user(target_user.id, msg)
|
||||
@@mq_router.publish_to_user(target_user.id, msg)
|
||||
else
|
||||
begin
|
||||
UserMailer.scheduled_session_cancelled(target_user.email, notification_msg, music_session).deliver
|
||||
rescue => e
|
||||
@@log.error("Unable to send scheduled_session_cancelled email to offline user #{target_user.email} #{e}")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -756,17 +804,25 @@ module JamRuby
|
|||
|
||||
notification_msg = format_msg(notification.description, {:session => music_session})
|
||||
|
||||
msg = @@message_factory.scheduled_session_rescheduled(
|
||||
target_user.id,
|
||||
music_session.id,
|
||||
notification_msg,
|
||||
music_session.description,
|
||||
music_session.scheduled_start,
|
||||
notification.id,
|
||||
notification.created_date
|
||||
)
|
||||
if target_user.online
|
||||
msg = @@message_factory.scheduled_session_rescheduled(
|
||||
target_user.id,
|
||||
music_session.id,
|
||||
notification_msg,
|
||||
music_session.description,
|
||||
music_session.scheduled_start,
|
||||
notification.id,
|
||||
notification.created_date
|
||||
)
|
||||
|
||||
@@mq_router.publish_to_user(target_user.id, msg)
|
||||
@@mq_router.publish_to_user(target_user.id, msg)
|
||||
else
|
||||
begin
|
||||
UserMailer.scheduled_session_rescheduled(target_user.email, notification_msg, music_session).deliver
|
||||
rescue => e
|
||||
@@log.error("Unable to send scheduled_session_rescheduled email to offline user #{target_user.email} #{e}")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -786,17 +842,25 @@ module JamRuby
|
|||
|
||||
notification_msg = format_msg(notification.description, {:session => music_session})
|
||||
|
||||
msg = @@message_factory.scheduled_session_reminder(
|
||||
target_user.id,
|
||||
music_session.id,
|
||||
notification_msg,
|
||||
music_session.description,
|
||||
music_session.scheduled_start,
|
||||
notification.id,
|
||||
notification.created_date
|
||||
)
|
||||
if target_user.online
|
||||
msg = @@message_factory.scheduled_session_reminder(
|
||||
target_user.id,
|
||||
music_session.id,
|
||||
notification_msg,
|
||||
music_session.description,
|
||||
music_session.scheduled_start,
|
||||
notification.id,
|
||||
notification.created_date
|
||||
)
|
||||
|
||||
@@mq_router.publish_to_user(target_user.id, msg)
|
||||
@@mq_router.publish_to_user(target_user.id, msg)
|
||||
else
|
||||
begin
|
||||
UserMailer.scheduled_session_reminder(target_user.email, notification_msg, music_session).deliver
|
||||
rescue => e
|
||||
@@log.error("Unable to send scheduled_session_reminder email to offline user #{target_user.email} #{e}")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -816,18 +880,26 @@ module JamRuby
|
|||
|
||||
notification_msg = format_msg(notification.description, {:session => music_session})
|
||||
|
||||
msg = @@message_factory.scheduled_session_comment(
|
||||
target_user.id,
|
||||
music_session.id,
|
||||
notification_msg,
|
||||
comment,
|
||||
music_session.description,
|
||||
music_session.scheduled_start,
|
||||
notification.id,
|
||||
notification.created_date
|
||||
)
|
||||
if target_user.online
|
||||
msg = @@message_factory.scheduled_session_comment(
|
||||
target_user.id,
|
||||
music_session.id,
|
||||
notification_msg,
|
||||
comment,
|
||||
music_session.description,
|
||||
music_session.scheduled_start,
|
||||
notification.id,
|
||||
notification.created_date
|
||||
)
|
||||
|
||||
@@mq_router.publish_to_user(target_user.id, msg)
|
||||
@@mq_router.publish_to_user(target_user.id, msg)
|
||||
else
|
||||
begin
|
||||
UserMailer.scheduled_session_comment(target_user.email, notification_msg, comment, music_session).deliver
|
||||
rescue => e
|
||||
@@log.error("Unable to send scheduled_session_comment email to offline user #{target_user.email} #{e}")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue