send emails for each message in lesson chat
This commit is contained in:
parent
16d8e0fffe
commit
6a4e099a18
|
|
@ -2010,7 +2010,12 @@ module JamRuby
|
||||||
@session_description = @lesson_session.music_session.description
|
@session_description = @lesson_session.music_session.description
|
||||||
@session_date = @lesson_session.slot.pretty_scheduled_start(true)
|
@session_date = @lesson_session.slot.pretty_scheduled_start(true)
|
||||||
@user = @target
|
@user = @target
|
||||||
email = @lesson_session.school_over_teacher
|
if chat_msg.user == chat_msg.lesson_session.student
|
||||||
|
email = @lesson_session.school_over_teacher
|
||||||
|
else
|
||||||
|
email = [chat_msg.lesson_session.student.email]
|
||||||
|
end
|
||||||
|
|
||||||
@subject = "#{@sender.name} has sent you a message about a lesson"
|
@subject = "#{@sender.name} has sent you a message about a lesson"
|
||||||
unique_args = {:type => "lesson_chat"}
|
unique_args = {:type => "lesson_chat"}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -61,9 +61,8 @@ module JamRuby
|
||||||
lesson_session.save(validate: false)
|
lesson_session.save(validate: false)
|
||||||
|
|
||||||
# a nil purpose means 'normal chat', which is the only time we should send an email
|
# a nil purpose means 'normal chat', which is the only time we should send an email
|
||||||
if !target.online? && purpose.nil? && message.present?
|
if !target.online? && message.present?
|
||||||
UserMailer.lesson_chat(chat_msg).deliver_now
|
UserMailer.lesson_chat(chat_msg).deliver_now
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue