VRFS-2318 show JOIN button for non-scheduled (future) session
This commit is contained in:
parent
275fb34d52
commit
257421a1d0
|
|
@ -455,6 +455,7 @@ module JamRuby
|
|||
def self.participant_create(user, music_session_id, client_id, as_musician, tracks, audio_latency, video_sources=nil)
|
||||
music_session = MusicSession.find(music_session_id)
|
||||
|
||||
# USERS ARE ALREADY IN SESSION
|
||||
if music_session.active_music_session
|
||||
connection = nil
|
||||
active_music_session = music_session.active_music_session
|
||||
|
|
@ -488,6 +489,8 @@ module JamRuby
|
|||
end
|
||||
|
||||
connection
|
||||
|
||||
# FIRST USER TO JOIN SESSION
|
||||
else
|
||||
return_value = nil
|
||||
|
||||
|
|
|
|||
|
|
@ -371,7 +371,16 @@ module JamRuby
|
|||
|
||||
ms.invitations << invitation
|
||||
|
||||
Notification.send_scheduled_session_invitation(ms, receiver)
|
||||
# if the session start time is not within the next 1 minute (user could create a "scheduled session"
|
||||
# for 8:30 at 8:29. In this case send the regular
|
||||
# send SCHEDULED SESSION INVITATION
|
||||
if ms.scheduled_start && (ms.scheduled_start - Time.now.utc) / 60 > 1
|
||||
Notification.send_scheduled_session_invitation(ms, receiver)
|
||||
|
||||
# otherwise send the notification that allows the user to join the session directly
|
||||
else
|
||||
Notification.send_session_invitation(receiver, user, ms.id)
|
||||
end
|
||||
end if options[:invitations]
|
||||
|
||||
options[:music_notations].each do |notation|
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ module JamRuby
|
|||
return "#{band_name} is now in a session."
|
||||
|
||||
when NotificationTypes::SCHEDULED_SESSION_INVITATION
|
||||
return "You have been invited to join a session by #{name}."
|
||||
return "You have been invited to a future session by #{name}."
|
||||
|
||||
when NotificationTypes::SCHEDULED_SESSION_RSVP
|
||||
return "#{name} would like to play in a session you have scheduled."
|
||||
|
|
|
|||
|
|
@ -651,26 +651,9 @@
|
|||
|
||||
handleNotification(payload, header.type);
|
||||
|
||||
var participants = [];
|
||||
rest.getSession(payload.session_id).done(function(response) {
|
||||
$.each(response.participants, function(index, val) {
|
||||
participants.push({"photo_url": context.JK.resolveAvatarUrl(val.user.photo_url), "name": val.user.name});
|
||||
});
|
||||
|
||||
var participantHtml = "You have been invited to join a session with: <br/><br/>";
|
||||
participantHtml += "<table><tbody>";
|
||||
|
||||
$.each(participants, function(index, val) {
|
||||
if (index < 4) {
|
||||
participantHtml += "<tr><td><img class='avatar-small' src='" + context.JK.resolveAvatarUrl(val.photo_url) + "' /></td><td>" + val.name + "</td></tr>";
|
||||
}
|
||||
});
|
||||
|
||||
participantHtml += "</tbody></table>";
|
||||
|
||||
app.notify({
|
||||
app.notify({
|
||||
"title": "Session Invitation",
|
||||
"text": participantHtml
|
||||
"text": payload.msg
|
||||
}, [{
|
||||
id: "btn-join",
|
||||
text: "JOIN SESSION",
|
||||
|
|
@ -684,8 +667,48 @@
|
|||
}
|
||||
}]
|
||||
);
|
||||
}).error(app.ajaxError);
|
||||
|
||||
// THERE IS A RACE CONDITION THAT CAUSES AN ERROR WHEN INVOKING THE CODE BELOW
|
||||
// THE ACTIVEMUSICSESSION HAS NOT YET BEEN FULLY CREATED B/C THE CREATOR'S CLIENT IS
|
||||
// STILL SETTING UP THE SESSION WHEN THE NOTIFICATION IS SENT
|
||||
|
||||
// SEE ActiveMusicSession#participant_create
|
||||
|
||||
// var participants = [];
|
||||
// rest.getSession(payload.session_id)
|
||||
// .done(function(response) {
|
||||
// $.each(response.participants, function(index, val) {
|
||||
// participants.push({"photo_url": context.JK.resolveAvatarUrl(val.user.photo_url), "name": val.user.name});
|
||||
// });
|
||||
|
||||
// var participantHtml = "You have been invited to join a session with: <br/><br/>";
|
||||
// participantHtml += "<table><tbody>";
|
||||
|
||||
// $.each(participants, function(index, val) {
|
||||
// if (index < 4) {
|
||||
// participantHtml += "<tr><td><img class='avatar-small' src='" + context.JK.resolveAvatarUrl(val.photo_url) + "' /></td><td>" + val.name + "</td></tr>";
|
||||
// }
|
||||
// });
|
||||
|
||||
// participantHtml += "</tbody></table>";
|
||||
|
||||
// app.notify({
|
||||
// "title": "Session Invitation",
|
||||
// "text": participantHtml
|
||||
// }, [{
|
||||
// id: "btn-join",
|
||||
// text: "JOIN SESSION",
|
||||
// "layout-action": "close",
|
||||
// href: "#",
|
||||
// "class": "button-orange",
|
||||
// callback: openTerms,
|
||||
// callback_args: {
|
||||
// "session_id": payload.session_id,
|
||||
// "notification_id": payload.notification_id
|
||||
// }
|
||||
// }]
|
||||
// );
|
||||
// }).error(app.ajaxError);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue