Submission api no longer causes 500 error
A regression happened that broke SIS grade pass back in the following gerrit: https://gerrit.instructure.com/#/c/62210/ fixes CNVS-23599 Test plan: * Create a course * Create an assignment * Create a submission for that assignment * Make an api call with: /api/v1/courses/<courseid>/assignments/<assignmentid>/submissions?include[]=user * Ensure an internal server error does not occur and that the submission json includes a user for each submission. Change-Id: I1c5bf4d88fe2e8ff8f9b73878e0860a06a566b7c Reviewed-on: https://gerrit.instructure.com/63970 Tested-by: Jenkins Reviewed-by: Derek Bender <djbender@instructure.com> QA-Review: Steven Shepherd <sshepherd@instructure.com> Product-Review: Steven Burnett <sburnett@instructure.com>
This commit is contained in:
parent
a25f0253dc
commit
350a8a34e0
|
@ -65,7 +65,7 @@ module Api::V1::Submission
|
|||
end
|
||||
|
||||
if includes.include?("user")
|
||||
hash['user'] = user_json(submission.user, user, session, ['avatar_url'], submission.context, nil)
|
||||
hash['user'] = user_json(submission.user, current_user, session, ['avatar_url'], submission.context, nil)
|
||||
end
|
||||
|
||||
if assignment && includes.include?('user_summary')
|
||||
|
|
|
@ -126,6 +126,18 @@ describe 'Submissions API', type: :request do
|
|||
expect(json.size).to eq 1
|
||||
end
|
||||
|
||||
it "should include user" do
|
||||
json = api_call(:get,
|
||||
"/api/v1/sections/#{@section.id}/assignments/#{@a1.id}/submissions.json",
|
||||
{ :controller => 'submissions_api', :action => 'index',
|
||||
:format => 'json', :section_id => @section.id.to_s,
|
||||
:assignment_id => @a1.id.to_s },
|
||||
{ :include => %w(user) })
|
||||
expect(json.size).to eq 1
|
||||
expect(json[0]['user']).not_to be_nil
|
||||
expect(json[0]['user']['id']).to eq(@student1.id)
|
||||
end
|
||||
|
||||
it "should return assignment_visible" do
|
||||
@course.enable_feature!(:differentiated_assignments)
|
||||
json = api_call(:get,
|
||||
|
|
Loading…
Reference in New Issue