VRFS-933 more notification work

This commit is contained in:
Brian Smith 2013-12-30 22:35:38 -05:00
parent 102306e4d1
commit 5b31e802d6
13 changed files with 13803 additions and 26 deletions

View File

@ -90,7 +90,6 @@
######### NOTIFICATION EMAILS #########
def friend_request(source_user, target_user)
@user = source_user
sendgrid_category "Notification"
@ -117,6 +116,7 @@
@user = source_user
sendgrid_category "Notification"
sendgrid_unique_args :type => "new_user_follower"
mail(:to => target_user.email, :subject => "You have a new follower on JamKazam") do |format|
format.text
format.html
@ -127,14 +127,23 @@
@user, @band = source_user, band
sendgrid_category "Notification"
sendgrid_unique_args :type => "new_band_follower"
mail(:to => target_user, :subject => "Your band has a new follower on JamKazam") do |format|
mail(:to => target_user.email, :subject => "Your band has a new follower on JamKazam") do |format|
format.text
format.html
end
end
def session_invitation(source_user, target_user)
@user = target_user
@user = source_user
sendgrid_category "Notification"
sendgrid_unique_args :type => "session_invitation"
mail(:to => target_user.email, :subject => "You have been invited to a session on JamKazam") do |format|
format.text
format.html
end
end
def musician_session_join(user)

View File

@ -1,3 +1,3 @@
<% provide(:title, 'New JamKazam Friend Request') %>
<p><% @user.name %> has sent you a friend request on JamKazam.</p>
<p><%= @user.name %> has sent you a friend request on JamKazam.</p>

View File

@ -1 +1 @@
<% @user.name %> has sent you a friend request on JamKazam.
<%= @user.name %> has sent you a friend request on JamKazam.

View File

@ -1,3 +1,3 @@
<% provide(:title, 'Friend Request Accepted') %>
<p><% @user.name %> has accepted your friend request on JamKazam.</p>
<p><%= @user.name %> has accepted your friend request on JamKazam.</p>

View File

@ -1 +1 @@
<% @user.name %> has accepted your friend request on JamKazam.
<%= @user.name %> has accepted your friend request on JamKazam.

View File

@ -1,3 +1,3 @@
<% provide(:title, 'New Band Follower on JamKazam') %>
<p><% @user.name %> is now following your band <%= @band.name %> on JamKazam.</p>
<p><%= @user.name %> is now following your band <%= @band.name %> on JamKazam.</p>

View File

@ -1 +1 @@
<% @user.name %> is now following your band <%= @band.name %> on JamKazam.
<%= @user.name %> is now following your band <%= @band.name %> on JamKazam.

View File

@ -0,0 +1,3 @@
<% provide(:title, 'New Follower on JamKazam') %>
<p><%= @user.name %> is now following you on JamKazam.</p>

View File

@ -0,0 +1 @@
<%= @user.name %> is now following you on JamKazam.

View File

@ -0,0 +1,3 @@
<% provide(:title, 'Session Invitation') %>
<p><%= @user.name %> has invited you to a session on JamKazam.</p>

View File

@ -0,0 +1 @@
<%= @user.name %> has invited you to a session on JamKazam.

View File

@ -240,14 +240,14 @@ module JamRuby
notification.save
# (2) create notification
if user.online
if friend.online
notification_msg = format_msg(notification.description, user)
msg = @@message_factory.friend_request(
friend_request_id,
user_id,
user.id,
user.name,
user.photo_url,
friend_id,
friend.id,
notification_msg,
notification.id,
notification.created_at.to_s
@ -274,22 +274,23 @@ module JamRuby
notification.save
# (2) create notification
if friend.online
if user.online
notification_msg = format_msg(notification.description, friend)
msg = @@message_factory.friend_request_accepted(
friend_id,
friend.id,
friend.name,
friend.photo_url,
user_id, notification_msg,
user.id,
notification_msg,
notification.id,
notification.created_at.to_s
)
# (3) send notification
@@mq_router.publish_to_user(user_id, msg)
@@mq_router.publish_to_user(user.id, msg)
else
# (2b) send email if user is offline
UserMailer.friend_request(friend, user)
UserMailer.friend_request_accepted(friend, user)
end
end
@ -358,6 +359,7 @@ module JamRuby
notifications = []
notification_msg = format_msg(notification.description, follower, band)
# these notifications go to each band member
band.band_musicians.each.each do |bm|
# create notifications (saved below in bulk)
@ -401,16 +403,22 @@ module JamRuby
notification.save
# (2) create notification
msg = @@message_factory.session_invitation(
receiver.id,
sender.name,
session_id,
notification.id,
notification.created_at.to_s
)
if receiver.online
msg = @@message_factory.session_invitation(
receiver.id,
sender.name,
session_id,
notification.id,
notification.created_at.to_s
)
# (3) send notification
@@mq_router.publish_to_user(receiver.id, msg)
# (2a) send notification
@@mq_router.publish_to_user(receiver.id, msg)
else
# (2b) send email if user is offline
UserMailer.session_invitation(sender, receiver)
end
end
################## SESSION ENDED ##################

13752
web/erl_crash.dump Normal file

File diff suppressed because one or more lines are too long