Go to file
Evan Battaglia fed8e96adc allow submission type LTIs to require a resource
Adds an option `require_resource_selection` for the
`submission_type_selection` placement to force a user to select a
resource (by launching the tool) before saving the assignment.

closes INTEROP-8626
flag=none

Note that the validation error message is intentionally brief to avoid
overflowing the allotted size for the error message popup/tooltip.

Test plan:
- have a tool with the submission_type_selection placement. In
  accordance with ContextExternalTool#placement_allowed?, you may need
  to add the domain or dev key to the allowed keys or allowed domains
  setting.
- edit the tool config (dev key config if the tool is 1.3) to have
  "require_resource_selection": true in the submission_type_selection
  placement settings.
- start creating a new assignment. Test out lots of different scenarios,
  but attempting to save the tool (for just testing whether the new
  validation triggers or not without actually saving the tool, you can
  always set the assignment title to be empty so the form won't actually
  submit), such as:
  - choosing submission type = "My Tool" and not doing anything else.
    there should be a validation error "Please click below to launch the
    tool and select a resource."
  - choosing submission type = "My Tool" and then launching and
    selecting a resource (no validation error)
  - selecting a resource and then hitting the 'x' to remove it
    (validation error)
  - selecting a resource, hitting the 'x' to remove it, choosing 'No
    Submission' and choosing 'My Tool' again. there shouldn't be any
    resource shown, and there should be a validation error.
  - selecting a resource, hitting the 'x' to remove it, clicking the
    button to launch the tool but closing the window before choosing
    another ressource. IT should show no resource and the validation
    error should trigger. Before this commit, it was showing the old (removed)
    resource.
  - selecting a resource, then choosing "External Tool". the URL should
    field should be emptied out and saving should fail with the
    (already existing) 'no URL' validation error.
  - selecting a resource, then choosing "External URL", and entering in
    some URL. this should succeed (make sure neither the "no URL" error
    or the new validation error are triggered)
  - choosing "External Tool" in the dropdown, then launching the tool in
    the normal assignment_selection placement and selecting a resource
    there. saving should succeed (this commit should only affect
    the submission_type_selection placement)
  - selecting a resource through assignment_selection as in the last
    step, and then choosing the tool in the dropdown
    (submission_type_selection placement). It should not show a resource
    and the validation should fail.
  - when you are done testing, choose the tool (as submission type
    selection) with content and save the assignment. ideally, send some
    custom variables in the deep linking response so you can test that
    those are maintained when editing the assignment.
- edit the assignment and test a variety of scenarios, including:
  - changing only title or description (don't type submission type at
    all). Save the tool. Check the Lti::ResourceLink in the database to
    make sure that the custom URL and/or custom parameters there have
    been preserved
  - switching to "No Submission" and back to the tool. This should
    show the resource preserved. Save and make sure the
    Lti::ResourceLink has been preserved.
  - switching to "External Tool". this should empty out the URL field
    and make the validation fail.
  - switching to "External Tool" as in the last check, but then set the
    dropdown back to the tool. There should not be a resource shown and
    saving should fire the validation.
  - edit again (reload the page if necessary) and just clear out the
    resource by clicking the 'x' under in the resource card. validation
    should fail.
  - remove and add back the resource. that should succeed (database
    Lti::ResourceLink should be updated with new data)
  - choose "External Tool" and choose the tool in assignment_selection.
    choose a resource and save the assignment. That should succeed and
    the Lti::ResourceLink in the DB should be updated.
- make an assignment with some other (ideally LTI 1.3) tool that doesn't
  have the submission_type_selection placement (or temporarily
  remove/disable submission_type_placement on your tool). edit the
  assignment without changing anything regarding submission type to make
  sure that still doesn't modify the resource link (if LTI 1.3)
- remove the require_resource_selection option on the tool
  and make sure you can create a new assignment using that tool's
  submission_type_selection placement without selecting a resource.
- if possible, to make sure we didn't severely make anything with
  MasteryConnect, test with a tool that acts like mastery connect:
  - change this line in the EditView.jsx:
    const mc_ext = item[LTI_EXT_MASTERY_CONNECT]
    to:
      const mc_ext = {points: 1, title: "foo", objectives: [],
        trackerName: 'foo', trackerAlignment: 'foo', studentCount: 0}
  - add an LTI 1.1 (cannot be 1.3) tool (such as Xander's vercel app)
    with the submission_type_selection placement and use
      Setting.set("submission_type_selection_allowed_launch_domains",
      ...) to allow it to use the placement (or stub out
      allowed_placement?)
  - play around with editing and editing a tool in the submission type
    selection placement. You will probably notice some difference (URL
    isn't cleared when you choose 'External Tool', values still exist
    when you choose the tool in the dropdown) but nothing should be too
  broken. At the very least, make sure you create an assignment with the
  tool, and then can edit the assignment and edit the description/title
  without changing the LTI stuff.

Change-Id: I86966abe815f6370db9e5723802398491c6fb66d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/348871
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Bence Árpási <bence.arpasi@instructure.com>
QA-Review: Bence Árpási <bence.arpasi@instructure.com>
Product-Review: Alexis Nast <alexis.nast@instructure.com>
2024-06-17 22:54:33 +00:00
.github
.storybook finish colocating QUnit test files 2024-06-13 11:40:57 +00:00
.vscode Add Registration Wizard state management 2024-06-06 16:02:14 +00:00
Gemfile.d Ensure media for links with undefined media id copy correctly 2024-06-17 18:35:15 +00:00
app allow submission type LTIs to require a resource 2024-06-17 22:54:33 +00:00
bin remove bundle binstub 2024-01-18 17:16:15 +00:00
build restore Karma/QUnit tests and re-enable partitioning 2024-06-12 17:06:03 +00:00
config rm old analytics feature flags 2024-06-17 18:21:55 +00:00
db/migrate add user input to discussion summary prototype 2024-06-17 09:13:26 +00:00
doc Add result context id and type to learning outcome result LE 2024-06-13 19:57:23 +00:00
docker-compose remove all code relating to inst api gateway 2024-04-09 16:55:37 +00:00
gems fix Redis' disconnect_if_idle with redis-cluster when not yet connected 2024-06-17 17:58:10 +00:00
hooks Politely suggest that new .js(x) files be in TypeScript 2023-11-14 03:07:16 +00:00
inst-cli remove Cassandra support for page views 2024-06-05 15:15:34 +00:00
jest fix MessageListActionContainer tests 2024-06-13 09:59:22 +00:00
lib allow submission type LTIs to require a resource 2024-06-17 22:54:33 +00:00
log remove deprecated build & log 2023-02-13 16:36:02 +00:00
packages [i18n] Update RCE translations. 2024-06-15 04:53:01 +00:00
patches patch format-message to fix CJS issue 2024-01-23 02:22:22 +00:00
public could there be more block editor? 2024-06-13 17:45:45 +00:00
script Force by_role linter to give -1 and not -2 2024-06-03 21:14:39 +00:00
spec allow submission type LTIs to require a resource 2024-06-17 22:54:33 +00:00
tmp
ui allow submission type LTIs to require a resource 2024-06-17 22:54:33 +00:00
ui-build remove spec/javascripts 2024-06-13 12:53:21 +00:00
vendor/gems/bundler-multilock bundle update bundler-multilock 2024-05-19 19:58:16 +00:00
.codeclimate.yml
.dependency-cruiser.js @canvas/test-utils and @canvas/package-tests 2024-06-13 11:41:10 +00:00
.devcontainer.json Add VSCode devcontainer configuration 2023-10-11 14:57:46 +00:00
.dive-ci
.dockerignore Create prod dockerfile for easy OSS use 2024-06-04 17:23:33 +00:00
.editorconfig
.eslintignore upgrade to jquery 3.5 2024-03-19 19:28:16 +00:00
.eslintrc.js colocate some QUnit tests 2024-06-05 17:32:28 +00:00
.git-blame-ignore-revs rubocop: update .git-blame-ignore-revs 2024-01-31 03:23:03 +00:00
.gitignore Add ICE design for Announcements desktop view 2024-05-24 10:19:06 +00:00
.gitmessage
.groovylintrc.json
.i18nignore
.i18nrc
.irbrc rubocop: fix miscelleneuos violations in prep of bumping rubocop 2023-04-12 19:26:13 +00:00
.lintstagedrc.js Improve pre-commit hook 2023-02-07 18:42:53 +00:00
.npmrc
.nvmrc Upgrade to node 18 2023-09-11 17:28:59 +00:00
.prettierrc
.rspec
.rubocop.yml rubocop: Rails/Date 2024-06-12 14:58:31 +00:00
.sentryignore
.stylelintrc
CONTRIBUTING.md
COPYRIGHT
Courses add all the custom recurrence UI 2023-07-14 12:55:32 +00:00
Dockerfile update bundler in dockerfiles 2024-06-05 21:06:07 +00:00
Dockerfile.githook
Dockerfile.jenkins update bundler in dockerfiles 2024-06-05 21:06:07 +00:00
Dockerfile.jenkins-cache remove spec/javascripts 2024-06-13 12:53:21 +00:00
Dockerfile.jenkins.final Unfreze bundle when using gem overrides 2023-08-24 17:25:57 +00:00
Dockerfile.jenkins.js
Dockerfile.jenkins.linters Unfreze bundle when using gem overrides 2023-08-24 17:25:57 +00:00
Dockerfile.jenkins.ruby-runner keep lockfiles in sync as part of `bundle` commands 2023-05-16 18:39:21 +00:00
Dockerfile.jenkins.webpack-assets
Dockerfile.jenkins.webpack-builder
Dockerfile.jenkins.webpack-cache
Dockerfile.jenkins.webpack-runner replace JS_BUILD_NO_UGLIFY; enable sourcemaps in jenkins 2024-01-29 20:33:23 +00:00
Dockerfile.jenkins.yarn-runner remove --ignore-optional flag 2024-01-17 23:34:02 +00:00
Dockerfile.package-translations remove python dep from package-translations build 2023-10-12 14:44:59 +00:00
Dockerfile.production update bundler in dockerfiles 2024-06-05 21:06:07 +00:00
Dockerfile.puma update bundler in dockerfiles 2024-06-05 21:06:07 +00:00
Gemfile bundle update rubocop 2024-05-30 16:20:52 +00:00
Gemfile.lock Ensure media for links with undefined media id copy correctly 2024-06-17 18:35:15 +00:00
Gemfile.rails71.lock Ensure media for links with undefined media id copy correctly 2024-06-17 18:35:15 +00:00
Jenkinsfile only trigger cystalball-map build from main-postmerge 2024-04-25 03:29:53 +00:00
Jenkinsfile.axe
Jenkinsfile.cassandra
Jenkinsfile.contract-tests Remove Canvas Outcome Pact Tests 2023-11-29 18:00:03 +00:00
Jenkinsfile.coverage emsure private defaults are used everywhere 2023-03-23 13:52:36 +00:00
Jenkinsfile.coverage-js restore Karma/QUnit tests and re-enable partitioning 2024-06-12 17:06:03 +00:00
Jenkinsfile.crystalball emsure private defaults are used everywhere 2023-03-23 13:52:36 +00:00
Jenkinsfile.dive
Jenkinsfile.docker-smoke move nodeLabel out of canvas-builds 2023-03-16 19:41:00 +00:00
Jenkinsfile.docker-sync upgrade chromedriver to latest version 120 2024-01-22 18:56:21 +00:00
Jenkinsfile.dynamodb
Jenkinsfile.js restore Karma/QUnit tests and re-enable partitioning 2024-06-12 17:06:03 +00:00
Jenkinsfile.junit-uploader move nodeLabel out of canvas-builds 2023-03-16 19:41:00 +00:00
Jenkinsfile.master-bouncer-check-all move withGerritCredentials to global shared library 2023-02-13 16:12:23 +00:00
Jenkinsfile.package-translations
Jenkinsfile.postgres
Jenkinsfile.redis
Jenkinsfile.rspecq specTimings isNumber check 2023-06-14 00:47:13 +00:00
Jenkinsfile.selenium.flakey_spec_catcher Remove auditor cassandra support 2023-04-03 15:40:22 +00:00
Jenkinsfile.selenium.performance.chrome remove dead / unused values 2023-03-13 21:28:52 +00:00
Jenkinsfile.test-subbuild
Jenkinsfile.vendored-gems Remove auditor cassandra support 2023-04-03 15:40:22 +00:00
Jenkinsfile.xbrowser
LICENSE
README.md
Rakefile
SECURITY.md Adding SECURITY.md for github. 2023-04-19 22:32:57 +00:00
bower.json
code_of_conduct.md
config.ru rubocop: Style/RedundantConstantBase 2023-04-10 20:56:27 +00:00
docker-compose.new-jenkins-flakey-spec-catcher.yml
docker-compose.new-jenkins-js.yml restore Karma/QUnit tests and re-enable partitioning 2024-06-12 17:06:03 +00:00
docker-compose.new-jenkins-package-translations.yml
docker-compose.new-jenkins-selenium.yml restore Karma/QUnit tests and re-enable partitioning 2024-06-12 17:06:03 +00:00
docker-compose.new-jenkins.consumer.yml
docker-compose.new-jenkins.vendored-gems.yml
docker-compose.new-jenkins.yml Use shared db for dynamo in Jenkins 2024-01-24 15:34:21 +00:00
docker-compose.spring.yml remove CommonJS from k5uploader 2024-02-22 20:18:45 +00:00
docker-compose.yml
gulpfile.js replace JS_BUILD_NO_UGLIFY; enable sourcemaps in jenkins 2024-01-29 20:33:23 +00:00
issue_template.md
jest.config.js use JSC in Jest instead of Babel 2024-01-18 00:11:45 +00:00
karma.conf.js remove spec/javascripts 2024-06-13 12:53:21 +00:00
package.json Update @instructure/ui-tabs@8.56.1 2024-06-13 19:31:16 +00:00
renovate.json Configure Renovate 2024-03-29 19:25:01 +00:00
rspack.config.js replace webpack with rspack 2024-02-08 23:02:33 +00:00
tsconfig.json use JSC in Jest instead of Babel 2024-01-18 00:11:45 +00:00
vitest.config.ts Add analytics hub as remote module 2024-04-26 13:26:39 +00:00
vitest.workspace.ts Install Vitest 2023-11-17 14:19:22 +00:00
yarn.lock Update @instructure/ui-tabs@8.56.1 2024-06-13 19:31:16 +00:00

README.md

Canvas LMS

Canvas is a modern, open-source LMS developed and maintained by Instructure Inc. It is released under the AGPLv3 license for use by anyone interested in learning more about or using learning management systems.

Please see our main wiki page for more information

Installation

Detailed instructions for installation and configuration of Canvas are provided on our wiki.