preserve "Until" time when copying discussion topics
test plan: - create an ungraded discussion topic with "Available at" and "Until" dates - copy the course - confirm the dates are preserved - confirm both dates move appropriately when you shift dates fixes CNVS-19043 Change-Id: I81b694b87e745dc098e2c6b306c2c0d6656c38ca Reviewed-on: https://gerrit.instructure.com/49898 Reviewed-by: Dan Minkevitch <dan@instructure.com> Tested-by: Jenkins Reviewed-by: James Williams <jamesw@instructure.com> QA-Review: Clare Strong <clare@instructure.com> Product-Review: Jon Willesen <jonw@instructure.com>
This commit is contained in:
parent
bca69aaef8
commit
b19f89d6ff
|
@ -176,6 +176,7 @@ module Importers
|
|||
|
||||
migration.imported_migration_items_by_class(DiscussionTopic).each do |event|
|
||||
event.delayed_post_at = shift_date(event.delayed_post_at, shift_options)
|
||||
event.lock_at = shift_date(event.lock_at, shift_options)
|
||||
event.save_without_broadcasting
|
||||
end
|
||||
|
||||
|
|
|
@ -89,6 +89,7 @@ module Importers
|
|||
|
||||
item.posted_at = Canvas::Migration::MigratorHelper.get_utc_time_from_timestamp(options[:posted_at])
|
||||
item.delayed_post_at = Canvas::Migration::MigratorHelper.get_utc_time_from_timestamp(options.delayed_post_at)
|
||||
item.lock_at = Canvas::Migration::MigratorHelper.get_utc_time_from_timestamp(options[:lock_at])
|
||||
item.last_reply_at = item.posted_at if item.new_record?
|
||||
|
||||
if options[:workflow_state].present?
|
||||
|
|
|
@ -56,6 +56,7 @@ module CC::Importer::Canvas
|
|||
topic['attachment_migration_id'] = get_node_val(meta_doc, 'attachment_identifierref')
|
||||
topic['posted_at'] = get_time_val(meta_doc, 'posted_at')
|
||||
topic['delayed_post_at'] = get_time_val(meta_doc, 'delayed_post_at')
|
||||
topic['lock_at'] = get_time_val(meta_doc, 'lock_at')
|
||||
topic['position'] = get_int_val(meta_doc, 'position')
|
||||
wf_state = get_node_val(meta_doc, 'workflow_state')
|
||||
topic['workflow_state'] = wf_state if wf_state.present?
|
||||
|
|
|
@ -108,6 +108,7 @@ module CC
|
|||
doc.title topic.title
|
||||
doc.posted_at ims_datetime(topic.posted_at) if topic.posted_at
|
||||
doc.delayed_post_at ims_datetime(topic.delayed_post_at) if topic.delayed_post_at
|
||||
doc.lock_at ims_datetime(topic.lock_at) if topic.lock_at
|
||||
doc.position topic.position
|
||||
doc.external_feed_identifierref CCHelper.create_key(topic.external_feed) if topic.external_feed
|
||||
doc.attachment_identifierref CCHelper.create_key(topic.attachment) if topic.attachment
|
||||
|
|
|
@ -133,6 +133,7 @@
|
|||
<xs:element name="assignment" type="assignmentType" minOccurs="0"/>
|
||||
<xs:element name="posted_at" type="xs:dateTime" minOccurs="0"/>
|
||||
<xs:element name="delayed_post_at" type="xs:dateTime" minOccurs="0"/>
|
||||
<xs:element name="lock_at" type="xs:dateTime" minOccurs="0"/>
|
||||
<xs:element name="position" type="xs:integer" minOccurs="0"/>
|
||||
<xs:element name="pinned" type="xs:boolean" minOccurs="0"/>
|
||||
<xs:element name="require_initial_post" type="xs:boolean" minOccurs="0"/>
|
||||
|
|
|
@ -23,7 +23,8 @@ describe ContentMigration do
|
|||
)
|
||||
@copy_from.discussion_topics.create!(:title => "some topic",
|
||||
:message => "<p>some text</p>",
|
||||
:delayed_post_at => @old_start + 3.days)
|
||||
:delayed_post_at => @old_start + 3.days,
|
||||
:lock_at => @old_start + 7.days)
|
||||
@copy_from.announcements.create!(:title => "hear ye",
|
||||
:message => "<p>grades will henceforth be in Cyrillic letters</p>",
|
||||
:delayed_post_at => @old_start + 10.days)
|
||||
|
@ -66,6 +67,7 @@ describe ContentMigration do
|
|||
|
||||
new_disc = @copy_to.discussion_topics.first
|
||||
expect(new_disc.delayed_post_at.to_i).to eq (@new_start + 3.day).to_i
|
||||
expect(new_disc.lock_at.to_i).to eq (@new_start + 7.day).to_i
|
||||
|
||||
new_ann = @copy_to.announcements.first
|
||||
expect(new_ann.delayed_post_at.to_i).to eq (@new_start + 10.day).to_i
|
||||
|
|
|
@ -51,7 +51,9 @@ describe ContentMigration do
|
|||
end
|
||||
|
||||
it "should properly copy selected delayed announcements" do
|
||||
from_ann = @copy_from.announcements.create!(:message => "goodbye", :title => "goodbye announcement", delayed_post_at: 1.hour.from_now)
|
||||
from_time = 1.hour.from_now
|
||||
until_time = 25.hours.from_now
|
||||
from_ann = @copy_from.announcements.create!(:message => "goodbye", :title => "goodbye announcement", delayed_post_at: from_time, lock_at: until_time)
|
||||
from_ann.workflow_state = "post_delayed"
|
||||
from_ann.save!
|
||||
|
||||
|
@ -62,6 +64,8 @@ describe ContentMigration do
|
|||
|
||||
to_ann = @copy_to.announcements.where(migration_id: mig_id(from_ann)).first
|
||||
expect(to_ann.workflow_state).to eq "post_delayed"
|
||||
expect(to_ann.delayed_post_at.to_i).to eq from_time.to_i
|
||||
expect(to_ann.lock_at.to_i).to eq until_time.to_i
|
||||
end
|
||||
|
||||
it "should not copy announcements if not selected" do
|
||||
|
|
Loading…
Reference in New Issue