VRFS-1985 detect browser / invalid config when starting a session from the future sessions section
This commit is contained in:
parent
e9d2df58df
commit
e516983aa5
|
|
@ -224,29 +224,11 @@
|
|||
}
|
||||
|
||||
if (showJoinLink) {
|
||||
// wire up the Join Link to the T&Cs dialog
|
||||
// wire up the Join Link to the T&Cs dialog
|
||||
$('.join-link', $parentRow).click(function(evt) {
|
||||
if(!context.JK.guardAgainstBrowser(app)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!context.JK.JamServer.connected) {
|
||||
app.notifyAlert("Not Connected", 'To create or join a session, you must be connected to the server.');
|
||||
return false;
|
||||
}
|
||||
|
||||
gearUtils.guardAgainstInvalidConfiguration(app)
|
||||
.fail(function() {
|
||||
app.notify(
|
||||
{ title: "Unable to Join Session",
|
||||
text: "You can only join a session once you have working audio gear and a tested internet connection."
|
||||
})
|
||||
})
|
||||
.done(function(){
|
||||
sessionUtils.joinSession(session.id);
|
||||
})
|
||||
|
||||
return false;
|
||||
sessionUtils.ensureValidClient(app, gearUtils, function() {
|
||||
sessionUtils.joinSession(session.id);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -368,7 +350,7 @@
|
|||
$('a.more.rsvps', $parentRow).click(toggleRsvps);
|
||||
|
||||
var showRsvpLink = true;
|
||||
var noLinkText = '';
|
||||
var sessionLinkText = '';
|
||||
$('.rsvp-link-text', $parentRow).hide();
|
||||
|
||||
function showStartSessionButton(scheduledStart) {
|
||||
|
|
@ -380,8 +362,8 @@
|
|||
|
||||
if (session.creator.id === context.JK.currentUserId) {
|
||||
showRsvpLink = false;
|
||||
noLinkText = $('<span class="text"><a class="start" style="color: #fc0">Start session now?</a></span>');
|
||||
noLinkText.find('a').click(function() {
|
||||
sessionLinkText = $('<span class="text"><a class="start" style="color: #fc0">Start session now?</a></span>');
|
||||
sessionLinkText.find('a').click(function() {
|
||||
ui.launchSessionStartDialog(session);
|
||||
return false;
|
||||
});
|
||||
|
|
@ -390,18 +372,18 @@
|
|||
showRsvpLink = false;
|
||||
|
||||
if (session.scheduled_start && showStartSessionButton(session.scheduled_start)) {
|
||||
noLinkText = $('<span class="text"><a class="start" style="color: #fc0">Start session now?</a> | <a class="cancel" style="color: #fc0">Cancel RSVP</a></span>');
|
||||
noLinkText.find('a.start').click(function() {
|
||||
sessionLinkText = $('<span class="text"><a class="start" style="color: #fc0">Start session now?</a> | <a class="cancel" style="color: #fc0">Cancel RSVP</a></span>');
|
||||
sessionLinkText.find('a.start').click(function() {
|
||||
ui.launchSessionStartDialog(session);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
else {
|
||||
noLinkText = $('<span class="text"><a class="cancel" style="color: #fc0">Cancel RSVP</a></span>');
|
||||
sessionLinkText = $('<span class="text"><a class="cancel" style="color: #fc0">Cancel RSVP</a></span>');
|
||||
}
|
||||
|
||||
// wire cancel link
|
||||
noLinkText.find('a.cancel').click(function() {
|
||||
sessionLinkText.find('a.cancel').click(function() {
|
||||
ui.launchRsvpCancelDialog(session.id, approvedRsvpId)
|
||||
.one(EVENTS.RSVP_CANCELED, function() {
|
||||
rest.getSessionHistory(session.id)
|
||||
|
|
@ -419,8 +401,8 @@
|
|||
showRsvpLink = false;
|
||||
|
||||
if (session.scheduled_start && showStartSessionButton(session.scheduled_start)) {
|
||||
noLinkText = $('<span class="text"><a class="start" style="color: #fc0">Start session now?</a></span>');
|
||||
noLinkText.find('a').click(function() {
|
||||
sessionLinkText = $('<span class="text"><a class="start" style="color: #fc0">Start session now?</a></span>');
|
||||
sessionLinkText.find('a').click(function() {
|
||||
ui.launchSessionStartDialog(session);
|
||||
return false;
|
||||
});
|
||||
|
|
@ -428,8 +410,8 @@
|
|||
}
|
||||
else if (pendingRsvpId) {
|
||||
showRsvpLink = false;
|
||||
noLinkText = $('<span class="text"><a class="cancel" style="color: #fc0">Cancel RSVP</a></span>');
|
||||
noLinkText.find('a').click(function() {
|
||||
sessionLinkText = $('<span class="text"><a class="cancel" style="color: #fc0">Cancel RSVP</a></span>');
|
||||
sessionLinkText.find('a').click(function() {
|
||||
ui.launchRsvpCancelDialog(session.id, pendingRsvpId)
|
||||
.one(EVENTS.RSVP_CANCELED, function() {
|
||||
rest.getSessionHistory(session.id)
|
||||
|
|
@ -445,11 +427,11 @@
|
|||
}
|
||||
else if (!openSlots) {
|
||||
showRsvpLink = false;
|
||||
noLinkText = '<span class="text">No more openings in this session.</span>';
|
||||
sessionLinkText = '<span class="text">No more openings in this session.</span>';
|
||||
}
|
||||
else if (!openRsvps && !hasInvitation) {
|
||||
showRsvpLink = false;
|
||||
noLinkText = '<span class="text">You need an invitation to RSVP to this session.</span>';
|
||||
sessionLinkText = '<span class="text">You need an invitation to RSVP to this session.</span>';
|
||||
}
|
||||
|
||||
if (showRsvpLink) {
|
||||
|
|
@ -472,7 +454,7 @@
|
|||
});
|
||||
}
|
||||
else {
|
||||
$('.rsvp-msg', $parentRow).html(noLinkText).show();
|
||||
$('.rsvp-msg', $parentRow).html(sessionLinkText).show();
|
||||
$('.rsvp-link', $parentRow).hide();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -125,7 +125,33 @@
|
|||
}
|
||||
}
|
||||
|
||||
sessionUtils.ensureValidClient = function(app, gearUtils, successCallback) {
|
||||
|
||||
if(!context.JK.guardAgainstBrowser(app)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!context.JK.JamServer.connected) {
|
||||
app.notifyAlert("Not Connected", 'To create or join a session, you must be connected to the server.');
|
||||
return false;
|
||||
}
|
||||
|
||||
gearUtils.guardAgainstInvalidConfiguration(app)
|
||||
.fail(function() {
|
||||
app.notify(
|
||||
{ title: "Unable to Join Session",
|
||||
text: "You can only join a session once you have working audio gear and a tested internet connection."
|
||||
});
|
||||
})
|
||||
.done(function() {
|
||||
if (successCallback) {
|
||||
successCallback();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
sessionUtils.joinSession = function(sessionId) {
|
||||
|
||||
var hasInvitation = false;
|
||||
var session = null;
|
||||
// we need to do a real-time check of the session in case the settings have
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
context.JK.UIHelper = function(app) {
|
||||
var logger = context.JK.logger;
|
||||
var rest = new context.JK.Rest();
|
||||
var sessionUtils = context.JK.SessionUtils;
|
||||
|
||||
function addSessionLike(sessionId, userId, $likeCountSelector, $likeButtonSelector) {
|
||||
rest.addSessionLike(sessionId, userId)
|
||||
|
|
@ -54,9 +55,11 @@
|
|||
}
|
||||
|
||||
function launchSessionStartDialog(session) {
|
||||
var sessionStartDialog = new JK.SessionStartDialog(JK.app, session);
|
||||
sessionStartDialog.initialize();
|
||||
return sessionStartDialog.showDialog();
|
||||
sessionUtils.ensureValidClient(app, context.JK.GearUtils, function() {
|
||||
var sessionStartDialog = new JK.SessionStartDialog(JK.app, session);
|
||||
sessionStartDialog.initialize();
|
||||
return sessionStartDialog.showDialog();
|
||||
});
|
||||
}
|
||||
|
||||
this.addSessionLike = addSessionLike;
|
||||
|
|
|
|||
Loading…
Reference in New Issue