Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix handling of user-related course form errors #224

Merged
merged 2 commits into from
Sep 18, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ require [

if action == 'action-identify-faculty-delegate'
unless validUserId.test(userId)
alert 'Instructor Computer ID is invalid. Please correct it before continuing.'
alert 'Instructor Computer ID contains invalid characters. Please correct it before continuing.'
return
user = new User(userId)
user.fetch()
Expand All @@ -169,6 +169,19 @@ require [

$(document).one 'userloaded', -> showFacultyStep()

$(document).one 'userloaderror', ->
# deregister the successful event listener to avoid duplicates later
$(document).off 'userloaded'
# bring user to a previous step to allow for correction
if action == 'action-identify-faculty-delegate'
# user was creating for someone else
alert 'Instructor Computing ID is invalid. Please double check before continuing.'
showDelegateStep()
else
# user was creating for him/herself; this error is unlikely, but we handle it anyway
alert 'Your Computing ID is invalid. Please contact Canvas help.'
showStep '1'

showFacultyStep = ->
$('.username-display').text(getUsernameToDisplay())
$('#sandbox-name-display').text("Sandbox - #{user.get('sfu_id')} - #{timeId}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ define [
@on 'change', ->
@hasLoaded = true
$(document).trigger 'userloaded'
@on 'error', ->
@hasLoaded = false
$(document).trigger 'userloaderror'
super

url: ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def create
end

def sis_user_id(username, account_id)
user = Pseudonym.find_by_unique_id_and_account_id(username, account_id)
user = Pseudonym.active.find_by_unique_id_and_account_id(username, account_id)
user.sis_user_id unless user.nil?
end

Expand Down