Revert "add LTI ResourceLink variables expansions / substitutions"
This reverts commit aa04a41504
.
Reason for revert: something about the order of guard clauses trips up retrieve launches for LTI 1.3 tools, like embedded content. easy enough to nail down and fix but it's affecting so much that we will just revert first and fix later
Change-Id: Id9dc816d784ff6d042f35aa3d1ae71633756f452
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/282047
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Mysti Lilla <mysti@instructure.com>
QA-Review: Mysti Lilla <mysti@instructure.com>
Product-Review: Xander Moffatt <xmoffatt@instructure.com>
This commit is contained in:
parent
a3a57c03a4
commit
a2a9e67e99
|
@ -146,63 +146,6 @@ module Lti
|
|||
end
|
||||
end
|
||||
|
||||
# LTI - Custom parameter substitution: ResourceLink.id
|
||||
# Returns the LTI value for the resource_link.id property
|
||||
# Returns an empty string otherwise.
|
||||
register_expansion "ResourceLink.id", [],
|
||||
lambda {
|
||||
line_item = @assignment.line_items.first
|
||||
line_item&.resource_id
|
||||
},
|
||||
ASSIGNMENT_GUARD,
|
||||
-> { @assignment.submission_types == "external_tool" && @assignment.line_items.present? },
|
||||
default_name: "resourcelink_id"
|
||||
|
||||
# LTI - Custom parameter substitution: ResourceLink.description
|
||||
# Returns resource_link.description property
|
||||
# Returns an empty string otherwise.
|
||||
register_expansion "ResourceLink.description", [],
|
||||
-> { @assignment.description },
|
||||
ASSIGNMENT_GUARD,
|
||||
-> { @assignment.description.present? },
|
||||
default_name: "resourcelink_description"
|
||||
|
||||
# LTI - Custom parameter substitution: ResourceLink.title
|
||||
# Returns resource_link.title property
|
||||
# Returns an empty string otherwise.
|
||||
register_expansion "ResourceLink.title", [],
|
||||
-> { @assignment.title },
|
||||
ASSIGNMENT_GUARD,
|
||||
-> { @assignment.title.present? },
|
||||
default_name: "resourcelink_title"
|
||||
|
||||
# LTI - Custom parameter substitution: ResourceLink.available.startDateTime
|
||||
# Returns the ISO 8601 date and time when this resource is available for learners to access.
|
||||
# Returns an empty string otherwise.
|
||||
register_expansion "ResourceLink.available.startDateTime", [],
|
||||
-> { @assignment.unlock_at.iso8601(3) },
|
||||
ASSIGNMENT_GUARD,
|
||||
-> { @assignment.unlock_at.present? },
|
||||
default_name: "resourcelink_available_startdatetime"
|
||||
|
||||
# LTI - Custom parameter substitution: ResourceLink.available.endDateTime
|
||||
# Returns the ISO 8601 date and time when this resource ceases to be available for learners to access.
|
||||
# Returns an empty string otherwise.
|
||||
register_expansion "ResourceLink.available.endDateTime", [],
|
||||
-> { @assignment.lock_at.iso8601(3) },
|
||||
ASSIGNMENT_GUARD,
|
||||
-> { @assignment.lock_at.present? },
|
||||
default_name: "resourcelink_available_enddatetime"
|
||||
|
||||
# LTI - Custom parameter substitution: ResourceLink.submission.endDateTime
|
||||
# Returns the ISO 8601 date and time when this resource stops accepting submissions.
|
||||
# Returns an empty string otherwise.
|
||||
register_expansion "ResourceLink.submission.endDateTime", [],
|
||||
-> { @assignment.due_at.iso8601(3) },
|
||||
ASSIGNMENT_GUARD,
|
||||
-> { @assignment.due_at.present? },
|
||||
default_name: "resourcelink_submission_enddatetime"
|
||||
|
||||
# If the current user is an observer in the launch
|
||||
# context, this substitution returns a comma-separated
|
||||
# list of user IDs linked to the current user for
|
||||
|
|
|
@ -115,13 +115,7 @@ module Lti
|
|||
com.instructure.Person.pronouns
|
||||
com.instructure.User.observees
|
||||
com.instructure.User.sectionNames
|
||||
com.instructure.Observee.sisIds
|
||||
ResourceLink.id
|
||||
ResourceLink.description
|
||||
ResourceLink.title
|
||||
ResourceLink.available.startDateTime
|
||||
ResourceLink.available.endDateTime
|
||||
ResourceLink.submission.endDateTime]
|
||||
com.instructure.Observee.sisIds]
|
||||
end
|
||||
|
||||
describe "#supported_capabilities" do
|
||||
|
|
|
@ -1432,102 +1432,6 @@ module Lti
|
|||
end
|
||||
end
|
||||
|
||||
context "when the assignment has external_tool as a submission_type" do
|
||||
let(:course) { course_factory }
|
||||
|
||||
let(:developer_key) { DeveloperKey.create! }
|
||||
|
||||
let(:tool) do
|
||||
ContextExternalTool.create!(
|
||||
context: course,
|
||||
tool_id: 1234,
|
||||
name: "test tool",
|
||||
consumer_key: "key",
|
||||
shared_secret: "secret",
|
||||
url: "https://www.tool.com/launch",
|
||||
developer_key: developer_key,
|
||||
settings: { use_1_3: true }
|
||||
)
|
||||
end
|
||||
|
||||
let(:right_now) { Time.zone.now }
|
||||
|
||||
let(:assignment) do
|
||||
opts = {
|
||||
course: course,
|
||||
external_tool_tag_attributes: {
|
||||
url: tool.url,
|
||||
content_type: "ContextExternalTool",
|
||||
content_id: tool.id
|
||||
},
|
||||
title: "Activity XYZ",
|
||||
description: "This is a super fun activity",
|
||||
submission_types: "external_tool",
|
||||
points_possible: 8.5,
|
||||
workflow_state: "published",
|
||||
unlock_at: right_now,
|
||||
due_at: right_now,
|
||||
lock_at: right_now
|
||||
}
|
||||
assignment = assignment_model opts
|
||||
|
||||
line_item = assignment.line_items.first
|
||||
line_item.update!(
|
||||
{
|
||||
resource_id: "abc",
|
||||
tag: "def"
|
||||
}
|
||||
)
|
||||
|
||||
assignment
|
||||
end
|
||||
|
||||
let(:variable_expander) do
|
||||
VariableExpander.new(
|
||||
root_account,
|
||||
course,
|
||||
controller,
|
||||
assignment: assignment
|
||||
)
|
||||
end
|
||||
|
||||
it "has substitution for $ResourceLink.id" do
|
||||
exp_hash = { test: "$ResourceLink.id" }
|
||||
variable_expander.expand_variables!(exp_hash)
|
||||
expect(exp_hash[:test]).to eq "abc"
|
||||
end
|
||||
|
||||
it "has substitution for $ResourceLink.description" do
|
||||
exp_hash = { test: "$ResourceLink.description" }
|
||||
variable_expander.expand_variables!(exp_hash)
|
||||
expect(exp_hash[:test]).to eq "This is a super fun activity"
|
||||
end
|
||||
|
||||
it "has substitution for $ResourceLink.title" do
|
||||
exp_hash = { test: "$ResourceLink.title" }
|
||||
variable_expander.expand_variables!(exp_hash)
|
||||
expect(exp_hash[:test]).to eq "Activity XYZ"
|
||||
end
|
||||
|
||||
it "has substitution for $ResourceLink.available.startDateTime" do
|
||||
exp_hash = { test: "$ResourceLink.available.startDateTime" }
|
||||
variable_expander.expand_variables!(exp_hash)
|
||||
expect(exp_hash[:test]).to eq right_now.iso8601(3)
|
||||
end
|
||||
|
||||
it "has substitution for $ResourceLink.available.endDateTime" do
|
||||
exp_hash = { test: "$ResourceLink.available.endDateTime" }
|
||||
variable_expander.expand_variables!(exp_hash)
|
||||
expect(exp_hash[:test]).to eq right_now.iso8601(3)
|
||||
end
|
||||
|
||||
it "has substitution for $ResourceLink.submission.endDateTime" do
|
||||
exp_hash = { test: "$ResourceLink.submission.endDateTime" }
|
||||
variable_expander.expand_variables!(exp_hash)
|
||||
expect(exp_hash[:test]).to eq right_now.iso8601(3)
|
||||
end
|
||||
end
|
||||
|
||||
context "context is a course with an assignment" do
|
||||
let(:variable_expander) { VariableExpander.new(root_account, course, controller, tool: tool, collaboration: collaboration) }
|
||||
|
||||
|
|
Loading…
Reference in New Issue