Merge pull request #19988 from raccoongang/fix_errors_not_shown_at_instructor_dashboard_course_team_management
Fix bug: error messages are not shown in Course Team Management
This commit is contained in:
@@ -269,12 +269,12 @@ such that the value can be defined later than this assignment (file load order).
|
||||
this.clear_input();
|
||||
if (data.userDoesNotExist) {
|
||||
msg = gettext("Could not find a user with username or email address '<%- identifier %>'.");
|
||||
return this.show_errors(_.template(msg, {
|
||||
return this.show_errors(_.template(msg)({
|
||||
identifier: data.unique_student_identifier
|
||||
}));
|
||||
} else if (data.inactiveUser) {
|
||||
msg = gettext("Error: User '<%- username %>' has not yet activated their account. Users must create and activate their accounts before they can be assigned a role."); // eslint-disable-line max-len
|
||||
return this.show_errors(_.template(msg, {
|
||||
return this.show_errors(_.template(msg)({
|
||||
username: data.unique_student_identifier
|
||||
}));
|
||||
} else if (data.removingSelfAsInstructor) {
|
||||
|
||||
@@ -63,6 +63,31 @@ define(['jquery',
|
||||
expect($('.auth-list-container.active .add-field').attr('disabled')).toBe(undefined);
|
||||
});
|
||||
|
||||
it('Error message is shown if user with given identifier does not exist', function() {
|
||||
var url, params;
|
||||
var requests = AjaxHelpers.requests(this);
|
||||
$('.active .add-field').val('smth');
|
||||
$('.active .add').click();
|
||||
expect(requests.length).toEqual(1);
|
||||
|
||||
url = '/courses/course-v1:edx+ed202+2017_T3/instructor/api/modify_access';
|
||||
params = $.param({
|
||||
unique_student_identifier: 'smth',
|
||||
rolename: 'staff',
|
||||
action: 'allow'
|
||||
});
|
||||
AjaxHelpers.expectPostRequest(requests, url, params);
|
||||
|
||||
AjaxHelpers.respondWithJson(requests, {
|
||||
unique_student_identifier: 'smth',
|
||||
userDoesNotExist: true
|
||||
});
|
||||
|
||||
expect($('.request-response-error').text()).toEqual(
|
||||
"Could not find a user with username or email address 'smth'."
|
||||
);
|
||||
});
|
||||
|
||||
it('When no discussions division scheme is selected error is shown and inputs are disabled', function() {
|
||||
var requests = AjaxHelpers.requests(this),
|
||||
data,
|
||||
|
||||
Reference in New Issue
Block a user