diff --git a/lib/lti/variable_expander.rb b/lib/lti/variable_expander.rb index 1294e45d664..f8d213ec870 100644 --- a/lib/lti/variable_expander.rb +++ b/lib/lti/variable_expander.rb @@ -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 diff --git a/spec/lib/lti/capabilities_helper_spec.rb b/spec/lib/lti/capabilities_helper_spec.rb index 7d33a65654d..90c0f0eb0a7 100644 --- a/spec/lib/lti/capabilities_helper_spec.rb +++ b/spec/lib/lti/capabilities_helper_spec.rb @@ -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 diff --git a/spec/lib/lti/variable_expander_spec.rb b/spec/lib/lti/variable_expander_spec.rb index 10da340b3c9..e4d80d0fef0 100644 --- a/spec/lib/lti/variable_expander_spec.rb +++ b/spec/lib/lti/variable_expander_spec.rb @@ -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) }