preserve publish state of external tool module items on copy
test plan: - ensure external tool module items preserve published state across course copy/export/import fixes CNVS-33928 Change-Id: Ib44a77756055b34c99f24c4d31a64f2befc507eb Reviewed-on: https://gerrit.instructure.com/98099 Tested-by: Jenkins Reviewed-by: James Williams <jamesw@instructure.com> QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com> Product-Review: Jeremy Stanley <jeremy@instructure.com>
This commit is contained in:
parent
0c033edb40
commit
f5f78ae746
|
@ -300,7 +300,7 @@ module Importers
|
|||
item.migration_id = hash[:migration_id]
|
||||
item.new_tab = hash[:new_tab]
|
||||
item.position = (context_module.item_migration_position ||= context_module.content_tags.not_deleted.map(&:position).compact.max || 0)
|
||||
if hash[:workflow_state] && ContentTag::TABLELESS_CONTENT_TYPES.include?(item.content_type) && !['active', 'published'].include?(item.workflow_state)
|
||||
if hash[:workflow_state] && !item.sync_workflow_state_to_asset? && !['active', 'published'].include?(item.workflow_state)
|
||||
item.workflow_state = hash[:workflow_state]
|
||||
end
|
||||
context_module.item_migration_position += 1
|
||||
|
|
|
@ -656,5 +656,20 @@ describe ContentMigration do
|
|||
expect(new_tag1).to be_published
|
||||
expect(new_tag2).to be_unpublished
|
||||
end
|
||||
|
||||
it "preserves publish state of external tool items" do
|
||||
tool = @copy_from.context_external_tools.create!(:name => "b", :url => "http://derp.derp/somethingelse", :consumer_key => '12345', :shared_secret => 'secret')
|
||||
mod = @copy_from.context_modules.create!(:name => "some module")
|
||||
tag1 = mod.add_item :type => 'context_external_tool', :id => tool.id, :url => "#{tool.url}?queryyyyy=something"
|
||||
tag1.publish!
|
||||
tag2 = mod.add_item :type => 'context_external_tool', :id => tool.id, :url => "#{tool.url}?queryyyyy=something"
|
||||
|
||||
run_course_copy
|
||||
|
||||
new_tag1 = @copy_to.context_module_tags.where(:migration_id => mig_id(tag1)).first
|
||||
new_tag2 = @copy_to.context_module_tags.where(:migration_id => mig_id(tag2)).first
|
||||
expect(new_tag1).to be_published
|
||||
expect(new_tag2).to be_unpublished
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue