VRFS-2974 fixed broadcast widget bug when session is private
This commit is contained in:
parent
128a8119cf
commit
3ae34fc426
|
|
@ -74,6 +74,9 @@
|
|||
|
||||
var playState = PlayStateNone; // tracks if the stream is actually playing
|
||||
|
||||
var CANNOT_BROADCAST_TITLE = 'Unable to Broadcast Session';
|
||||
var CANNOT_BROADCAST_MSG = 'This session cannot be broadcasted. The session organizer may have configured it to be private.';
|
||||
|
||||
function play(e) {
|
||||
if(e) {
|
||||
e.preventDefault();
|
||||
|
|
@ -407,17 +410,21 @@
|
|||
sessionInfo = response;
|
||||
})
|
||||
.fail(function(jqXHR) {
|
||||
if(jqXHR.status == 404 || jqXHR.status == 403) {
|
||||
if(jqXHR.status == 404) {
|
||||
transition(PlayStateSessionOver);
|
||||
destroy();
|
||||
}
|
||||
else if (jqXHR.status == 403) {
|
||||
logger.debug("session is private");
|
||||
context.JK.app.notify({"title": CANNOT_BROADCAST_TITLE, "text": CANNOT_BROADCAST_MSG});
|
||||
}
|
||||
else if(jqXHR.status >= 500 && jqXHR.status <= 599){
|
||||
transition(PlayStateServerError);
|
||||
}
|
||||
else {
|
||||
transition(PlayStateNetworkError);
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
function triggerStateChange() {
|
||||
|
|
@ -702,28 +709,31 @@
|
|||
}
|
||||
|
||||
function openBubble() {
|
||||
checkServer().done(function(response) {
|
||||
checkServer()
|
||||
.done(function(response) {
|
||||
|
||||
var mountId = sessionInfo.mount ? sessionInfo.mount.id : null;
|
||||
var mountId = sessionInfo.mount ? sessionInfo.mount.id : null;
|
||||
|
||||
if(mountId) {
|
||||
rest.getMount({id: mountId})
|
||||
.done(function (mount) {
|
||||
mountInfo = mount;
|
||||
$parent.data('mount-id', mountId);
|
||||
context.JK.SubscriptionUtils.subscribe('mount', mountId).on(context.JK.EVENTS.SUBSCRIBE_NOTIFICATION, onDetailEvent);
|
||||
$parent.btOn();
|
||||
})
|
||||
.fail(context.JK.app.ajaxError)
|
||||
}
|
||||
else {
|
||||
mountInfo = null;
|
||||
destroy();
|
||||
context.JK.app.notify({"title": "Unable to Broadcast Session", "text": "This session cannot be broadcasted. The session organizer may have configured it to be private."});
|
||||
}
|
||||
})
|
||||
.fail(function() {
|
||||
logger.debug("session is over")
|
||||
if(mountId) {
|
||||
rest.getMount({id: mountId})
|
||||
.done(function (mount) {
|
||||
mountInfo = mount;
|
||||
$parent.data('mount-id', mountId);
|
||||
context.JK.SubscriptionUtils.subscribe('mount', mountId).on(context.JK.EVENTS.SUBSCRIBE_NOTIFICATION, onDetailEvent);
|
||||
$parent.btOn();
|
||||
})
|
||||
.fail(context.JK.app.ajaxError)
|
||||
}
|
||||
else {
|
||||
mountInfo = null;
|
||||
destroy();
|
||||
context.JK.app.notify({"title": CANNOT_BROADCAST_TITLE, "text": CANNOT_BROADCAST_MSG});
|
||||
}
|
||||
})
|
||||
.fail(function(response) {
|
||||
if (response.status == 404) {
|
||||
logger.debug("session is over");
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -165,7 +165,8 @@ class ApiMusicSessionsController < ApiController
|
|||
|
||||
def show
|
||||
unless @music_session.can_see? current_user
|
||||
raise ActiveRecord::RecordNotFound
|
||||
# render :json => { :message => ValidationMessages::PERMISSION_VALIDATION_ERROR }, :status => 403
|
||||
raise JamRuby::PermissionError
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue