Stop always showing blueprint_settings on selective contents

fixes LF-807
flag=none

Test Plan:
- Course copy a non BP course into another
- Opt for a selective import
- Check blueprint settings are not among
  the content options
- Course copy a BP course into a another course
  (the second course can have no students)
- Opt for a selective import
- Check blueprint settings are among the content
  options present in the modal

Change-Id: I0f986c1bb55f45e2441fe4274375e074afa5a335
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/330250
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Juan Chavez <juan.chavez@instructure.com>
Reviewed-by: Eric Saupe <eric.saupe@instructure.com>
QA-Review: Eric Saupe <eric.saupe@instructure.com>
Product-Review: Luis Oliveira <luis.oliveira@instructure.com>
This commit is contained in:
Matheus 2023-10-12 16:26:55 -03:00 committed by Luis Oliveira
parent e6069d9174
commit ce7b8ed253
3 changed files with 12 additions and 5 deletions

View File

@ -326,7 +326,7 @@ module Canvas::Migration::Helpers
content_list << { type: "syllabus_body", property: "#{property_prefix}[all_syllabus_body]", title: COURSE_SYLLABUS_TYPE.call }
content_list << { type: "course_paces", property: "#{property_prefix}[all_course_paces]", title: COURSE_PACE_TYPE.call } if source.course_paces.primary.not_deleted.any?
if @migration && MasterCourses::MasterTemplate.blueprint_eligible?(@migration.context)
if @migration && MasterCourses::MasterTemplate.is_master_course?(source) && MasterCourses::MasterTemplate.blueprint_eligible?(@migration.context)
content_list << { type: "blueprint_settings", property: "#{property_prefix}[all_blueprint_settings]", title: BLUEPRINT_SETTING_TYPE.call }
end

View File

@ -846,7 +846,6 @@ describe ContentMigrationsController, type: :request do
json = api_call(:get, @migration_url, @params)
expect(json).to eq [{ "type" => "course_settings", "property" => "copy[all_course_settings]", "title" => "Course Settings" },
{ "type" => "syllabus_body", "property" => "copy[all_syllabus_body]", "title" => "Syllabus Body" },
{ "type" => "blueprint_settings", "property" => "copy[all_blueprint_settings]", "title" => "Blueprint Settings" },
{ "type" => "context_modules", "property" => "copy[all_context_modules]", "title" => "Modules", "count" => 1, "sub_items_url" => "http://www.example.com/api/v1/courses/#{@orig_course.id}/content_migrations/#{@migration.id}/selective_data?type=context_modules" },
{ "type" => "discussion_topics", "property" => "copy[all_discussion_topics]", "title" => "Discussion Topics", "count" => 1, "sub_items_url" => "http://www.example.com/api/v1/courses/#{@orig_course.id}/content_migrations/#{@migration.id}/selective_data?type=discussion_topics" },
{ "type" => "wiki_pages", "property" => "copy[all_wiki_pages]", "title" => "Pages", "count" => 1, "sub_items_url" => "http://www.example.com/api/v1/courses/#{@orig_course.id}/content_migrations/#{@migration.id}/selective_data?type=wiki_pages" },

View File

@ -227,7 +227,6 @@ describe Canvas::Migration::Helpers::SelectiveContentFormatter do
let(:top_level_items) do
[{ type: "course_settings", property: "copy[all_course_settings]", title: "Course Settings" },
{ type: "syllabus_body", property: "copy[all_syllabus_body]", title: "Syllabus Body" },
{ type: "blueprint_settings", property: "copy[all_blueprint_settings]", title: "Blueprint Settings" },
{ type: "context_modules", property: "copy[all_context_modules]", title: "Modules", count: 1, sub_items_url: "https://example.com?type=context_modules" },
{ type: "tool_profiles", property: "copy[all_tool_profiles]", title: "Tool Profiles", count: 1, sub_items_url: "https://example.com?type=tool_profiles" },
{ type: "discussion_topics", property: "copy[all_discussion_topics]", title: "Discussion Topics", count: 1, sub_items_url: "https://example.com?type=discussion_topics" },
@ -269,6 +268,16 @@ describe Canvas::Migration::Helpers::SelectiveContentFormatter do
expect(formatter.get_content_list("announcements").length).to eq 1
end
it "lists blueprint_settings when appropriate" do
allow(@migration).to receive(:context).and_return(course_model)
allow(MasterCourses::MasterTemplate).to receive(:is_master_course?).and_return(true)
expect(formatter.get_content_list).to include({
property: "copy[all_blueprint_settings]",
title: "Blueprint Settings",
type: "blueprint_settings"
})
end
context "with selectable_outcomes_in_course_copy disabled" do
before do
@course.root_account.disable_feature!(:selectable_outcomes_in_course_copy)
@ -369,8 +378,7 @@ describe Canvas::Migration::Helpers::SelectiveContentFormatter do
it "ignores in top-level list" do
expect(formatter.get_content_list).to eq [{ type: "course_settings", property: "copy[all_course_settings]", title: "Course Settings" },
{ type: "syllabus_body", property: "copy[all_syllabus_body]", title: "Syllabus Body" },
{ type: "blueprint_settings", property: "copy[all_blueprint_settings]", title: "Blueprint Settings" }]
{ type: "syllabus_body", property: "copy[all_syllabus_body]", title: "Syllabus Body" }]
end
it "ignores in specific item request" do