Allow description for submission_type_selection
why:
- To allow tools at this placement to specify an additional bit of
description other than just title.
- Additionally, we've removed support for the
submission_type_selection_launch_points configuration option.
It was determined this is no longer required.
flag=none
fixes INTEROP-8478
test-plan:
- Note: This is very similar to the plan in d78cbba
.
- Install the LTI 1.3 test tool (or any other tool) in the
submission_type_selection placement.
- Modify the configuration for the submission_type_selection placement
so that it now includes a description property. You can do this by
editing the JSON on the dev keys page or through the Rails console
with something like:
```ruby
tc = DeveloperKey.find(123456).tool_configuration
tc.settings["extensions"].first["settings"]["placements"].find {|p|
p.placement == "submission_type_selection}["description"] = "foobarbaz"
tc.save!
```
- It should save without causing issues.
- Go to the new Assignment page, open the web console, then type
`ENV.SUBMISSION_TYPE_SELECTION_TOOLS` and look for the tool you
modified. A description property should now be present with the
description you just put in.
Change-Id: I0a032eec4202c725dea6dcea7450101c6db124b6
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/341194
Reviewed-by: Evan Battaglia <ebattaglia@instructure.com>
QA-Review: Evan Battaglia <ebattaglia@instructure.com>
Product-Review: Alexis Nast <alexis.nast@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
This commit is contained in:
parent
e7cafa957e
commit
857473bbe0
|
@ -530,8 +530,8 @@ class ApplicationController < ActionController::Base
|
|||
end
|
||||
hash[:base_title] = tool.default_label(I18n.locale) if custom_settings.include?(:base_title)
|
||||
hash[:external_url] = tool.url if custom_settings.include?(:external_url)
|
||||
if type == :submission_type_selection && tool.submission_type_selection[:submission_type_selection_launch_points].present?
|
||||
hash[:submission_type_selection_launch_points] = tool.submission_type_selection[:submission_type_selection_launch_points]
|
||||
if type == :submission_type_selection && tool.submission_type_selection[:description].present?
|
||||
hash[:description] = tool.submission_type_selection[:description]
|
||||
end
|
||||
|
||||
hash
|
||||
|
|
|
@ -46,32 +46,6 @@ module Schemas::Lti
|
|||
}.freeze,
|
||||
}.freeze
|
||||
|
||||
SUBMISSION_LAUNCH_POINTS_SCHEMA =
|
||||
{
|
||||
"type" => "array",
|
||||
"items" => {
|
||||
"type" => "object",
|
||||
"required" => %w[target_link_uri].freeze,
|
||||
"additionalProperties" => false,
|
||||
"properties" => {
|
||||
"target_link_uri" => {
|
||||
"type" => "string",
|
||||
"format" => "uri"
|
||||
}.freeze,
|
||||
"title" => {
|
||||
"type" => "string"
|
||||
}.freeze,
|
||||
"icon_url" => {
|
||||
"type" => "string",
|
||||
"format" => "uri"
|
||||
}.freeze,
|
||||
"description" => {
|
||||
"type" => "string"
|
||||
}.freeze
|
||||
}
|
||||
}
|
||||
}.freeze
|
||||
|
||||
SCHEMA = {
|
||||
"type" => "object",
|
||||
"required" => [
|
||||
|
@ -159,9 +133,13 @@ module Schemas::Lti
|
|||
"placement" => {
|
||||
"type" => "string",
|
||||
"pattern" => "^submission_type_selection$"
|
||||
},
|
||||
}.freeze,
|
||||
"description" => {
|
||||
"type" => "string",
|
||||
"maxLength" => 255,
|
||||
"errorMessage" => "description must be a string with a maximum length of 255 characters"
|
||||
}.freeze,
|
||||
**LAUNCH_INFO_SCHEMA,
|
||||
"submission_type_selection_launch_points" => SUBMISSION_LAUNCH_POINTS_SCHEMA
|
||||
}.freeze
|
||||
}.freeze
|
||||
].freeze }.freeze
|
||||
|
|
|
@ -2297,26 +2297,19 @@ describe AssignmentsController do
|
|||
)
|
||||
end
|
||||
|
||||
context "the tool includes a submission_type_selection_launch_points" do
|
||||
let(:launch_point) do
|
||||
{
|
||||
"target_link_uri" => "https://example.com/launch?placement=submission_type_selection",
|
||||
"title" => "Launch",
|
||||
"description" => "Launch the tool",
|
||||
"icon_url" => "https://example.com/icon.png",
|
||||
}
|
||||
end
|
||||
context "the tool includes a description propery" do
|
||||
let(:description) { "This is a description" }
|
||||
let(:tool_settings) do
|
||||
super().tap do |options|
|
||||
options[:submission_type_selection_launch_points] = [launch_point]
|
||||
end
|
||||
res = super()
|
||||
res[:description] = description
|
||||
res
|
||||
end
|
||||
|
||||
it "includes the launch points" do
|
||||
tool
|
||||
subject
|
||||
expect(assigns[:js_env][:SUBMISSION_TYPE_SELECTION_TOOLS][0])
|
||||
.to include(submission_type_selection_launch_points: [launch_point])
|
||||
.to include(description:)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -48,18 +48,22 @@ module Lti
|
|||
|
||||
it { is_expected.to be true }
|
||||
|
||||
context "with a valid submission_type_selection_launch_points" do
|
||||
context "with a description property at the submission_type_selection placement" do
|
||||
let(:settings) do
|
||||
super().tap do |c|
|
||||
c["extensions"].first["settings"]["submission_type_selection_launch_points"] = [
|
||||
{
|
||||
"target_link_uri" => "http://example.com/launch?placement=submission_type_selection",
|
||||
"title" => "Test Title",
|
||||
"icon_url" => "https://static.thenounproject.com/png/131630-211.png",
|
||||
"description" => "Test Description"
|
||||
}
|
||||
]
|
||||
end
|
||||
res = super()
|
||||
|
||||
res["extensions"].first["settings"]["placements"].push(
|
||||
{
|
||||
"target_link_uri" => "http://example.com/launch?placement=submission_type_selection",
|
||||
"text" => "Test Title",
|
||||
"message_type" => "LtiResourceLinkRequest",
|
||||
"icon_url" => "https://static.thenounproject.com/png/131630-211.png",
|
||||
"description" => "Test Description",
|
||||
"placement" => "submission_type_selection",
|
||||
}
|
||||
)
|
||||
|
||||
res
|
||||
end
|
||||
|
||||
it { is_expected.to be true }
|
||||
|
@ -67,50 +71,44 @@ module Lti
|
|||
end
|
||||
|
||||
context "with non-matching schema" do
|
||||
let(:settings) do
|
||||
s = super()
|
||||
s.delete("target_link_uri")
|
||||
s
|
||||
end
|
||||
|
||||
before do
|
||||
tool_configuration.developer_key = developer_key
|
||||
end
|
||||
|
||||
it { is_expected.to be false }
|
||||
context "a missing target_link_uri" do
|
||||
let(:settings) do
|
||||
s = super()
|
||||
s.delete("target_link_uri")
|
||||
s
|
||||
end
|
||||
|
||||
it "is contains a message about missing target_link_uri" do
|
||||
tool_configuration.valid?
|
||||
expect(tool_configuration.errors[:configuration].first.message).to include("target_link_uri,")
|
||||
end
|
||||
end
|
||||
it { is_expected.to be false }
|
||||
|
||||
context "with an invalid submission_type_selection_launch_points" do
|
||||
let(:settings) do
|
||||
s = super()
|
||||
s["extensions"].first["settings"]["placements"] << {
|
||||
"placement" => "submission_type_selection",
|
||||
"message_type" => "LtiResourceLinkRequest",
|
||||
"submission_type_selection_launch_points" => [{
|
||||
# Invalid target_link_uri
|
||||
"target_link_uri" => "",
|
||||
"title" => 4,
|
||||
"icon_url" => "https://static.thenounproject.com/png/131630-211.png",
|
||||
"description" => "Test Description"
|
||||
}]
|
||||
}
|
||||
s
|
||||
it "contains a message about a missing target_link_uri" do
|
||||
tool_configuration.valid?
|
||||
expect(tool_configuration.errors[:configuration].first.message).to include("target_link_uri,")
|
||||
end
|
||||
end
|
||||
|
||||
before do
|
||||
tool_configuration.developer_key = developer_key
|
||||
end
|
||||
context "when the submission_type_selection description is longer than 255 characters" do
|
||||
let(:settings) do
|
||||
s = super()
|
||||
|
||||
it { is_expected.to be false }
|
||||
s["extensions"].first["settings"]["placements"].push(
|
||||
{
|
||||
"target_link_uri" => "http://example.com/launch?placement=submission_type_selection",
|
||||
"text" => "Test Title",
|
||||
"message_type" => "LtiResourceLinkRequest",
|
||||
"icon_url" => "https://static.thenounproject.com/png/131630-211.png",
|
||||
"description" => "a" * 256,
|
||||
"placement" => "submission_type_selection",
|
||||
}
|
||||
)
|
||||
|
||||
it "contains a message about invalid submission_type_selection placement" do
|
||||
tool_configuration.valid?
|
||||
expect(tool_configuration.errors[:configuration].first.message).to include("submission_type_selection")
|
||||
s
|
||||
end
|
||||
|
||||
it { is_expected.to be false }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue