only copy external feeds when selected

test plan:
 - create a course with an external feed (announcements page)
   and an assignment
 - copy the course. the copy should contain both.
 - copy the course, but select only the assignment. the copy
   should not contain the external feed.

fixes CNVS-14773

Change-Id: I321522c143e84a50d6a570967cb98505a8011800
Reviewed-on: https://gerrit.instructure.com/39393
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: James Williams  <jamesw@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
This commit is contained in:
Jeremy Stanley 2014-08-15 12:53:46 -06:00
parent 43754d6c38
commit 1096290e62
2 changed files with 7 additions and 0 deletions

View File

@ -35,6 +35,7 @@ module CC
"xsi:schemaLocation"=> "#{CCHelper::CANVAS_NAMESPACE} #{CCHelper::XSD_URI}"
) do |feeds_node|
@course.external_feeds.each do |feed|
next unless export_object?(feed)
migration_id = CCHelper.create_key(feed)
feeds_node.externalFeed(:identifier=>migration_id) do |feed_node|
feed_node.title feed.title if feed.title

View File

@ -172,6 +172,8 @@ describe ContentMigration do
rub2.data = data
rub2.save!
rub2.associate_with(@copy_from, @copy_from)
ef1 = @copy_from.external_feeds.create! feed_type: 'rss/atom', feed_purpose: 'announcements', url: 'https://feed1.example.org', verbosity: 'full'
ef2 = @copy_from.external_feeds.create! feed_type: 'rss/atom', feed_purpose: 'announcements', url: 'https://feed2.example.org', verbosity: 'full'
default = @copy_from.root_outcome_group
log = @copy_from.learning_outcome_groups.new
log.context = @copy_from
@ -197,6 +199,7 @@ describe ContentMigration do
:attachments => {mig_id(att) => "1", mig_id(att2) => "0"},
:wiki_pages => {mig_id(wiki) => "1", mig_id(wiki2) => "0"},
:rubrics => {mig_id(rub1) => "1", mig_id(rub2) => "0"},
:external_feeds => {mig_id(ef1) => "1", mig_id(ef2) => "0"}
}
@cm.save!
@ -220,6 +223,9 @@ describe ContentMigration do
@copy_to.created_learning_outcomes.find_by_migration_id(mig_id(lo)).should be_nil
@copy_to.learning_outcome_groups.find_by_migration_id(mig_id(log)).should be_nil
@copy_to.external_feeds.find_by_migration_id(mig_id(ef1)).should_not be_nil
@copy_to.external_feeds.find_by_migration_id(mig_id(ef2)).should be_nil
end
it "should re-copy deleted items" do