lms
lms copied to clipboard
Fix content item selection form wonkiness
Although it "works" the behaviour of the content item selection form is a little wonky. For example in the case of an LMS that doesn't support content item selection, so the form is being submitted back to our own server rather than to the LMS:
• It includes the content_items
form field, whose value is a JSON object containing the selected document, even though our server doesn't read this form field
• Since our server doesn't pass ltiLaunchUrl
to the JavaScript in this case, the LTI launch URL in the content_items
field ends up as undefined?url=<DOCUMENT_URL>
(which doesn't matter, since the server doesn't read it anyway)
• The document URL is also included a second time in its own simple top-level document_url
form field, which is what the server actually reads
I suspect that in the other case, when the form is being submitted to the LMS, it contains a bunch of fields that're only for our server and not read by the LMS.
This could be fixed on the frontend by having it be aware of whether we're doing LTI content item selection or submitting to our own server, and submit different forms. Or it could be fixed on the backend by having our server support receiving LTI content item selection forms, so that the frontend's behaviour is the same in both cases.
If fixing on the backend remaining backwards-compatible with existing assignments already created in production will be a concern.
See Slack discussion: https://hypothes-is.slack.com/archives/C4K6M7P5E/p1560350243230700