use ids instead of role names for course roster filtering

test plan:
* create a custom course role
* delete it
* create another custom course role with the exact same name
* invite people into a course with that role
* should be able to select the role from the drop-down on the
 people page and find people

refs #CNVS-18343

Change-Id: I7f62d76984af1d92179d3541b03e41801c53327c
Reviewed-on: https://gerrit.instructure.com/48486
Reviewed-by: Dan Minkevitch <dan@instructure.com>
Product-Review: Dan Minkevitch <dan@instructure.com>
Tested-by: Jenkins
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
This commit is contained in:
James Williams 2015-02-09 13:15:00 -07:00
parent bf8d94ea8a
commit 31d28cd4f7
3 changed files with 21 additions and 2 deletions

View File

@ -18,7 +18,7 @@
>
<select
name="enrollment_role"
name="enrollment_role_id"
data-view="roleSelect"
aria-label='{{#t "role_to_search"}}Limit search to role{{/t}}'
></select>

View File

@ -1,6 +1,6 @@
<option value="">{{#t "all_roles"}}All Roles{{/t}}</option>
{{#each roles}}
<option value="{{name}}" {{#ifEqual name ../selectedRole}} selected="selected" {{/ifEqual}}>{{label}} ({{count}})</option>
<option value="{{id}}" {{#ifEqual id ../selectedRole}} selected="selected" {{/ifEqual}}>{{label}} ({{count}})</option>
{{/each}}

View File

@ -330,4 +330,23 @@ describe "people" do
is_checked('#limit_privileges_to_course_section') == true
end
end
it "should filter by role ids" do
account_model
course_with_teacher_logged_in(:account => @account)
old_role = custom_student_role("Role")
old_role.deactivate!
new_role = @account.roles.new(:name => old_role.name)
new_role.base_role_type = "StudentEnrollment"
new_role.save!
new_role
student_in_course(:course => @course, :role => new_role, :name => "number2")
get "/courses/#{@course.id}/users"
click_option("select[name=enrollment_role_id]", new_role.id.to_s, :value)
wait_for_ajaximations
expect(ff('tr.rosterUser').count).to eq 1
end
end