fix resource_link_id in gradespeeder launch
closes QUIZ-8106 flag=none test plan: - complete a NQ student submission - in speedgrader, launch a student submission - in devtool/network, make sure `context_id` and `resource_link_id` are different, and `resource_link_id` is assignment.lti_resource_link_id Change-Id: I30b2e929bd31e1241776c1ad838432bd8e2e5cec Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/256408 Reviewed-by: Weston Dransfield <wdransfield@instructure.com> Reviewed-by: Stephen Kacsmark <skacsmark@instructure.com> QA-Review: Mark McDermott <mmcdermott@instructure.com> Product-Review: Han Yan <hyan@instructure.com> Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
This commit is contained in:
parent
abf83a1573
commit
59674c925b
|
@ -537,9 +537,15 @@ class ExternalToolsController < ApplicationController
|
|||
selected_html: params[:selection],
|
||||
domain: HostUrl.context_host(@domain_root_account, request.host)
|
||||
}
|
||||
|
||||
opts = default_opts.merge(opts)
|
||||
|
||||
assignment = api_find(@context.assignments.active, params[:assignment_id]) if params[:assignment_id]
|
||||
|
||||
# from specs, seems this is only a fix for Quizzes Next
|
||||
# resource_link_id in regular QN launches is assignment.lti_resource_link_id
|
||||
opts[:link_code] = @tool.opaque_identifier_for(assignment.external_tool_tag) if assignment.present? && assignment.quiz_lti?
|
||||
|
||||
expander = variable_expander(assignment: assignment,
|
||||
tool: tool, launch: lti_launch,
|
||||
post_message_token: opts[:launch_token],
|
||||
|
|
|
@ -916,6 +916,41 @@ describe ExternalToolsController do
|
|||
expect(assigns[:lti_launch].params['ext_lti_assignment_id']).to eq lti_assignment_id
|
||||
end
|
||||
|
||||
context 'for Quizzes Next launch' do
|
||||
let(:assignment) { assignment_model(course: @course) }
|
||||
|
||||
before do
|
||||
params = {
|
||||
:name => "Quizzes.Next",
|
||||
:url => 'http://example.com/launch',
|
||||
:domain => "example.com",
|
||||
:consumer_key => 'test_key',
|
||||
:shared_secret => 'test_secret',
|
||||
:privacy_level => 'public',
|
||||
:tool_id => 'Quizzes 2'
|
||||
}
|
||||
account.context_external_tools.create!(params)
|
||||
assignment.submission_types = 'external_tool'
|
||||
assignment.external_tool_tag_attributes = {url: "http://example.com/launch"}
|
||||
assignment.save!
|
||||
end
|
||||
|
||||
it 'sets consistent resource_link_id with that in regular lti launch' do
|
||||
u = user_factory(active_all: true)
|
||||
account.account_users.create!(user: u)
|
||||
user_session(@user)
|
||||
|
||||
get :retrieve, params: {
|
||||
course_id: @course.id,
|
||||
assignment_id:assignment.id,
|
||||
url: 'http://example.com/launch'
|
||||
}
|
||||
|
||||
expect(assigns[:lti_launch].params['resource_link_id']).to eq assignment.lti_resource_link_id
|
||||
expect(assigns[:lti_launch].params['context_id']).to eq opaque_id(@course)
|
||||
end
|
||||
end
|
||||
|
||||
context 'collaborations' do
|
||||
let(:collab) do
|
||||
collab = ExternalToolCollaboration.new(
|
||||
|
|
Loading…
Reference in New Issue