forked from External/greenlight
better error handling for youtube uploading
This commit is contained in:
parent
14bb88ad77
commit
6e343740e8
|
@ -310,7 +310,11 @@ class @Recordings
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: url+'/'+id
|
url: url+'/'+id
|
||||||
data: {video_title: title, privacy_status: privacy_status}
|
data: {video_title: title, privacy_status: privacy_status}
|
||||||
success: () ->
|
success: (data) ->
|
||||||
|
|
||||||
|
if data['url'] != null
|
||||||
|
window.location.href = data['url']
|
||||||
|
else
|
||||||
cloud = selectedUpload.find('.cloud-blue')
|
cloud = selectedUpload.find('.cloud-blue')
|
||||||
check = selectedUpload.find('.green-check')
|
check = selectedUpload.find('.green-check')
|
||||||
spinner = selectedUpload.find('.load-spinner')
|
spinner = selectedUpload.find('.load-spinner')
|
||||||
|
@ -319,6 +323,7 @@ class @Recordings
|
||||||
|
|
||||||
spinner.hide()
|
spinner.hide()
|
||||||
check.show()
|
check.show()
|
||||||
|
|
||||||
setTimeout ( ->
|
setTimeout ( ->
|
||||||
cloud.show()
|
cloud.show()
|
||||||
check.hide()
|
check.hide()
|
||||||
|
|
|
@ -180,11 +180,23 @@ class BbbController < ApplicationController
|
||||||
title: params[:video_title],
|
title: params[:video_title],
|
||||||
description: t('youtube_description', url: 'https://bigbluebutton.org/'),
|
description: t('youtube_description', url: 'https://bigbluebutton.org/'),
|
||||||
privacy_status: params[:privacy_status])
|
privacy_status: params[:privacy_status])
|
||||||
rescue
|
rescue => e
|
||||||
|
errors = e.response_body['error']['errors']
|
||||||
|
# Many complications, start by getting them to refresh their token.
|
||||||
|
if errors.length > 1
|
||||||
|
redirect_url = user_login_url
|
||||||
|
else
|
||||||
|
error = errors[0]
|
||||||
|
if error['message'] == "Unauthorized"
|
||||||
|
redirect_url = 'https://m.youtube.com/create_channel'
|
||||||
|
else
|
||||||
# In this case, they don't have a youtube channel connected to their account, so prompt to create one.
|
# In this case, they don't have a youtube channel connected to their account, so prompt to create one.
|
||||||
redirect_to 'https://m.youtube.com/create_channel'
|
redirect_url = user_login_url
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
render json: {:url => redirect_url}
|
||||||
|
end
|
||||||
|
|
||||||
# POST /rooms/:room_id/recordings/can_upload
|
# POST /rooms/:room_id/recordings/can_upload
|
||||||
def can_upload
|
def can_upload
|
||||||
|
|
Loading…
Reference in New Issue