From 61b0ebaf7b9e3a999c141f8e98212c359312d3bf Mon Sep 17 00:00:00 2001 From: James Williams Date: Tue, 26 Nov 2019 06:35:17 -0700 Subject: [PATCH] prefer array for available_canvas_resources variable test plan: * launching a tool with the module_index_menu and assignment_index_menu placements should return an array of hashes for the com_instructure_course_available_canvas_resources variable, as described in the documentation refs #LA-75 Change-Id: I2c81ca611a60dfdc67d62823b35319353c4d846d Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/218693 Tested-by: Service Cloud Jenkins Tested-by: Jenkins Reviewed-by: Carl Kibler QA-Review: Carl Kibler Product-Review: James Williams --- lib/lti/variable_expander.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/lti/variable_expander.rb b/lib/lti/variable_expander.rb index d9b10e5f255..33ef80bea9c 100644 --- a/lib/lti/variable_expander.rb +++ b/lib/lti/variable_expander.rb @@ -1355,7 +1355,11 @@ module Lti # [{"id":"3","name":"First Module"},{"id":"5","name":"Second Module"}] # ``` register_expansion 'com.instructure.Course.available_canvas_resources', [], - -> { @request.parameters['com_instructure_course_available_canvas_resources']&.to_json }, + -> { + val = @request.parameters['com_instructure_course_available_canvas_resources'] + val = val.values if val.is_a?(Hash) + val&.to_json + }, default_name: 'com_instructure_course_available_canvas_resources' private