Revert "Remove New Quizzes Embedded Module Progression"

This reverts commit a7f0ea277a.

Reason for revert: the removal broke launching NQ on mobile

Change-Id: I1f719ce9317cfb1f4477098fe25fd7eb558b0d09
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/273543
Reviewed-by: Jeff Largent <jeff.largent@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Mark McDermott <mmcdermott@instructure.com>
Product-Review: Jackson Howe <jackson.howe@instructure.com>
This commit is contained in:
Jackson Howe 2021-09-16 18:35:49 +00:00
parent a7ee6c6876
commit 602fc440cd
6 changed files with 21 additions and 8 deletions

View File

@ -1843,6 +1843,7 @@ class ApplicationController < ActionController::Base
link_code: @opaque_id,
overrides: {'resource_link_title' => @resource_title},
domain: HostUrl.context_host(@domain_root_account, request.host),
include_module_context: Account.site_admin.feature_enabled?(:new_quizzes_in_module_progression)
}
variable_expander = Lti::VariableExpander.new(@domain_root_account, @context, self,{
current_user: @current_user,
@ -1950,7 +1951,7 @@ class ApplicationController < ActionController::Base
def external_tool_redirect_display_type
if params['display'].present?
params['display']
elsif @assignment&.quiz_lti? && @module_tag
elsif Account.site_admin.feature_enabled?(:new_quizzes_in_module_progression) && @assignment&.quiz_lti? && @module_tag
'in_nav_context'
else
@tool&.extension_setting(:assignment_selection)&.dig('display_type')

View File

@ -53,6 +53,7 @@ module Lti
link_code = opts[:link_code] || default_link_code
@overrides = opts[:overrides] || {}
link_params = opts[:link_params] || {}
include_module_context = opts[:include_module_context] || false
lti_context = Lti::LtiContextCreator.new(@context, @tool).convert
lti_user = Lti::LtiUserCreator.new(@user, @root_account, @tool, @context).convert if @user
@ -72,7 +73,8 @@ module Lti
tool: lti_tool,
account: lti_account,
variable_expander: variable_expander,
link_params: link_params
link_params: link_params,
include_module_context: include_module_context
}
)
self

View File

@ -51,3 +51,8 @@ new_quizzes_skip_to_build_module_button:
description: Provides a button which navigates straight to the Build screen in the kebab menu for New Quizzes items on the Modules page.
applies_to: SiteAdmin
state: hidden
new_quizzes_in_module_progression:
display_name: New Quizzes Embedded Module Progression
description: Improved support for taking New Quizzes from within Modules
applies_to: SiteAdmin
state: hidden

View File

@ -40,6 +40,7 @@ module LtiOutbound
@selected_html = options[:selected_html]
@link_params = options[:link_params] || {}
@consumer_instance = context.consumer_instance || raise('Consumer instance required for generating LTI content')
@include_module_context = options[:include_module_context] || false
@variable_expander = options[:variable_expander] || raise('VariableExpander is required for generating LTI content')
@hash = {}
@ -143,8 +144,10 @@ module LtiOutbound
def add_assignment_substitutions!(assignment)
if tool.public?
hash['custom_canvas_assignment_id'] = '$Canvas.assignment.id'
hash['custom_canvas_module_id'] = '$Canvas.module.id'
hash['custom_canvas_module_item_id'] = '$Canvas.moduleItem.id'
if @include_module_context
hash['custom_canvas_module_id'] = '$Canvas.module.id'
hash['custom_canvas_module_item_id'] = '$Canvas.moduleItem.id'
end
end
hash['custom_canvas_assignment_title'] = '$Canvas.assignment.title'

View File

@ -113,7 +113,8 @@ describe LtiOutbound::ToolLaunch do
:link_code => '123456',
:return_url => 'http://www.google.com',
:outgoing_email_address => 'outgoing_email_address',
:variable_expander => variable_expander)
:variable_expander => variable_expander,
:include_module_context => true)
end
describe '#generate' do
@ -418,7 +419,7 @@ describe LtiOutbound::ToolLaunch do
expect(hash['custom_canvas_assignment_points_possible']).to eq '$Canvas.assignment.pointsPossible'
end
it 'includes module context info' do
it 'includes module context info when associated option is true' do
tool_launch.for_assignment!(assignment, '/my/test/url', '/my/other/test/url', '/a/test/url')
hash = tool_launch.generate

View File

@ -953,7 +953,8 @@ RSpec.describe ApplicationController do
controller.send(:content_tag_redirect, course, content_tag, nil)
end
it 'overrides the configured display_type for the quiz_lti in module context' do
it 'overrides the configured display_type for the quiz_lti in module context when feature flag is on' do
Account.site_admin.enable_feature!(:new_quizzes_in_module_progression)
allow(content_tag.context).to receive(:quiz_lti?).and_return(true)
module1 = course.context_modules.create!(name: 'Module 1')
content_tag.context.context_module_tags.create!(context_module: module1, context: course, tag_type: 'context_module')