graphql: include inactive course users
refs RECNVS-270 Test plan: * make user(s) in a course inactive * make sure they show up in the course usersConnection Change-Id: Iffd24c8e307298406a0eaa5b99d055234da9ada5 Reviewed-on: https://gerrit.instructure.com/139038 Tested-by: Jenkins Reviewed-by: Michael Jasper <mjasper@instructure.com> QA-Review: Collin Parrish <cparrish@instructure.com> Product-Review: Cameron Matheson <cameron@instructure.com>
This commit is contained in:
parent
53133f3488
commit
8dd7a8645e
|
@ -41,9 +41,8 @@ module Types
|
|||
resolve ->(course, args, ctx) {
|
||||
if course.grants_any_right?(ctx[:current_user], ctx[:session],
|
||||
:read_roster, :view_all_grades, :manage_grades)
|
||||
scope = UserSearch.scope_for(course, ctx[:current_user], {})
|
||||
scope = UserSearch.scope_for(course, ctx[:current_user], include_inactive_enrollments: true)
|
||||
scope = scope.where(users: {id: args[:userIds]}) if args[:userIds].present?
|
||||
|
||||
scope
|
||||
else
|
||||
nil
|
||||
|
|
|
@ -122,12 +122,15 @@ describe Types::CourseType do
|
|||
before(:once) do
|
||||
@student1 = @student
|
||||
@student2 = student_in_course(active_all: true).user
|
||||
@inactive_user = student_in_course.tap { |enrollment|
|
||||
enrollment.update_attribute :workflow_state, 'inactive'
|
||||
}.user
|
||||
end
|
||||
|
||||
it "returns all visible users" do
|
||||
expect(
|
||||
course_type.usersConnection(current_user: @teacher)
|
||||
).to eq [@teacher, @student1, @student2]
|
||||
).to eq [@teacher, @student1, @student2, @inactive_user]
|
||||
end
|
||||
|
||||
it "returns only the specified users" do
|
||||
|
|
Loading…
Reference in New Issue