preserve `only_visible_to_overrides` for page assignments
test plan: - Enable Mastery Paths in the course or account - Create a course with a Module and add a Page and an Assignment as module items - Enable MP for Page - Add Page as a conditional content to an MP assignment - Login as a student to check that the page is not visible - Copy course into a new course shell - Login as a student in the child course - The page should not be visible before it is unlocked fixes ADMIN-1461 Change-Id: I4c0d02b33a78862edcb36914dfe531b24caad08f Reviewed-on: https://gerrit.instructure.com/167010 Tested-by: Jenkins QA-Review: Mysti Sadler <mysti@instructure.com> Product-Review: Jeremy Stanley <jeremy@instructure.com> Reviewed-by: Neil Gupta <ngupta@instructure.com> Reviewed-by: James Williams <jamesw@instructure.com>
This commit is contained in:
parent
78493fbc85
commit
e81febbab8
|
@ -49,7 +49,11 @@ module CC::Importer::Canvas
|
|||
wiki[:assignment] = nil
|
||||
wiki[:todo_date] = meta['todo_date']
|
||||
if asg_id = meta['assignment_identifier']
|
||||
wiki[:assignment] = { migration_id: asg_id }
|
||||
wiki[:assignment] = {
|
||||
migration_id: asg_id,
|
||||
assignment_overrides: [],
|
||||
only_visible_to_overrides: meta['only_visible_to_overrides'] == 'true'
|
||||
}
|
||||
end
|
||||
wiki
|
||||
end
|
||||
|
|
|
@ -40,8 +40,10 @@ module CC
|
|||
meta_fields[:workflow_state] = page.workflow_state
|
||||
meta_fields[:front_page] = page.is_front_page?
|
||||
meta_fields[:module_locked] = page.locked_by_module_item?(@user, deep_check_if_needed: true).present?
|
||||
meta_fields[:assignment_identifier] =
|
||||
page.for_assignment? ? create_key(page.assignment) : nil
|
||||
if page.for_assignment?
|
||||
meta_fields[:assignment_identifier] = create_key(page.assignment)
|
||||
meta_fields[:only_visible_to_overrides] = page.assignment.only_visible_to_overrides
|
||||
end
|
||||
meta_fields[:todo_date] = page.todo_date
|
||||
|
||||
File.open(path, 'w') do |file|
|
||||
|
|
|
@ -593,6 +593,18 @@ describe ContentMigration do
|
|||
expect(to_override.due_at_overridden).to eq true
|
||||
expect(to_override.unlock_at_overridden).to eq false
|
||||
end
|
||||
|
||||
it "preserves only_visible_to_overrides for page assignments" do
|
||||
a1 = assignment_model(context: @copy_from, title: 'a1', submission_types: 'wiki_page', only_visible_to_overrides: true)
|
||||
a1.build_wiki_page(title: a1.title, context: a1.context).save!
|
||||
a2 = assignment_model(context: @copy_from, title: 'a2', submission_types: 'wiki_page', only_visible_to_overrides: false)
|
||||
a2.build_wiki_page(title: a2.title, context: a2.context).save!
|
||||
run_course_copy
|
||||
a1_to = @copy_to.assignments.where(migration_id: mig_id(a1)).take
|
||||
expect(a1_to.only_visible_to_overrides).to eq true
|
||||
a2_to = @copy_to.assignments.where(migration_id: mig_id(a2)).take
|
||||
expect(a2_to.only_visible_to_overrides).to eq false
|
||||
end
|
||||
end
|
||||
|
||||
context 'external tools' do
|
||||
|
|
Loading…
Reference in New Issue