* VRFS-1975/VRFS-2003 - don't send two participant creates back-to-back
This commit is contained in:
parent
9af30cdde2
commit
6f79878f91
|
|
@ -571,7 +571,7 @@
|
|||
|
||||
function startSessionClicked() {
|
||||
var $btn = $(this);
|
||||
if($btn.is('.disabled')) { return; }
|
||||
if($btn.is('.disabled')) { return false; }
|
||||
$btn.addClass('disabled')
|
||||
|
||||
if(willOptionStartSession()) {
|
||||
|
|
@ -590,6 +590,8 @@
|
|||
else {
|
||||
startSession($btn);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// did the user have to pick the RSVP slots explicitely?
|
||||
|
|
@ -687,39 +689,12 @@
|
|||
}
|
||||
|
||||
var joinSession = function(sessionId) {
|
||||
var tracks = context.JK.TrackHelpers.getUserTracks(context.jamClient);
|
||||
|
||||
var options = {};
|
||||
options.client_id = app.clientId;
|
||||
options.session_id = sessionId;
|
||||
options.as_musician = true;
|
||||
options.tracks = tracks;
|
||||
rest.joinSession(options)
|
||||
.done(function(response) {
|
||||
var invitationCount = data.invitations.length;
|
||||
|
||||
context.location = '/client#/session/' + sessionId;
|
||||
|
||||
context.JK.GA.trackSessionCount(data.musician_access, data.fan_access, invitationCount);
|
||||
context.JK.GA.trackSessionMusicians(context.JK.GA.SessionCreationTypes.create);
|
||||
})
|
||||
.fail(function(jqXHR) {
|
||||
$startBtn.removeClass('disabled');
|
||||
var handled = false;
|
||||
if(jqXHR.status = 422) {
|
||||
var response = JSON.parse(jqXHR.responseText);
|
||||
if(response["errors"] && response["errors"]["tracks"] && response["errors"]["tracks"][0] == "Please select at least one track") {
|
||||
app.notifyAlert("No Inputs Configured", $('<span>You will need to reconfigure your audio device.</span>'));
|
||||
handled = true;
|
||||
}
|
||||
}
|
||||
if(!handled) {
|
||||
app.notifyServerError(jqXHR, "Unable to Create Session");
|
||||
}
|
||||
})
|
||||
.always(function() {
|
||||
})
|
||||
var invitationCount = data.invitations.length;
|
||||
context.JK.GA.trackSessionCount(data.musician_access, data.fan_access, invitationCount);
|
||||
|
||||
// we redirect to the session screen, which handles the REST call to POST /participants.
|
||||
logger.debug("joining session screen: " + sessionId)
|
||||
context.location = '/client#/session/' + sessionId;
|
||||
};
|
||||
|
||||
if (createSessionSettings.createType == 'start-scheduled') {
|
||||
|
|
|
|||
|
|
@ -315,6 +315,12 @@
|
|||
null,
|
||||
true);
|
||||
}
|
||||
else if(xhr.status == 422) {
|
||||
var response = JSON.parse(jqXHR.responseText);
|
||||
if(response["errors"] && response["errors"]["tracks"] && response["errors"]["tracks"][0] == "Please select at least one track") {
|
||||
app.notifyAlert("No Inputs Configured", $('<span>You will need to reconfigure your audio device.</span>'));
|
||||
}
|
||||
}
|
||||
else {
|
||||
app.notifyServerError(xhr, 'Unable to Join Session');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,17 +87,22 @@
|
|||
var deferred = joinSessionRest(sessionId);
|
||||
|
||||
deferred
|
||||
.done(function(){
|
||||
.done(function(response){
|
||||
logger.debug("calling jamClient.JoinSession");
|
||||
// on temporary disconnect scenarios, a user may already be in a session when they enter this path
|
||||
// so we avoid double counting
|
||||
if(!alreadyInSession()) {
|
||||
// on temporary disconnect scenarios, a user may already be in a session when they enter this path
|
||||
// so we avoid double counting
|
||||
if(response.music_session.participant_count == 1) {
|
||||
context.JK.GA.trackSessionMusicians(context.JK.GA.SessionCreationTypes.create);
|
||||
}
|
||||
else {
|
||||
context.JK.GA.trackSessionMusicians(context.JK.GA.SessionCreationTypes.join);
|
||||
}
|
||||
}
|
||||
|
||||
recordingModel.reset();
|
||||
client.JoinSession({ sessionID: sessionId });
|
||||
refreshCurrentSession();
|
||||
refreshCurrentSession(true);
|
||||
server.registerMessageCallback(context.JK.MessageType.SESSION_JOIN, trackChanges);
|
||||
server.registerMessageCallback(context.JK.MessageType.SESSION_DEPART, trackChanges);
|
||||
server.registerMessageCallback(context.JK.MessageType.TRACKS_CHANGED, trackChanges);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
object @connection
|
||||
|
||||
extends "api_music_sessions/participant_show"
|
||||
|
||||
child(:music_session => :music_session) {
|
||||
attributes :id
|
||||
|
||||
node :participant_count do |music_session|
|
||||
music_session.connections.length
|
||||
end
|
||||
}
|
||||
|
|
@ -1,11 +1,8 @@
|
|||
object @connection
|
||||
|
||||
attributes :ip_address, :client_id
|
||||
attributes :ip_address, :client_id, :user_id
|
||||
attribute :aasm_state => :connection_state
|
||||
|
||||
node(:user_id, :if => lambda { |connection| connection.user.friends?(current_user) }) do |connection|
|
||||
connection.user_id
|
||||
end
|
||||
child(:tracks => :tracks) {
|
||||
attributes :id, :instrument_id, :sound
|
||||
}
|
||||
Loading…
Reference in New Issue