let associated course make discussion non-graded
test plan: - create a graded discussion in a blueprint course (not locked) - sync to an associated course - in the associated course, edit the discussion and make it non-graded - in the blueprint course, edit the discussion body and perform a new sync - the discussion in the associated course should remain ungraded fixes ADMIN-2419 Change-Id: Id92285962e3082fe4a10910ad5aca36639f9ff52 Reviewed-on: https://gerrit.instructure.com/183176 Tested-by: Jenkins Reviewed-by: James Williams <jamesw@instructure.com> QA-Review: Jon Willesen <jonw+gerrit@instructure.com> Product-Review: Jeremy Stanley <jeremy@instructure.com>
This commit is contained in:
parent
9e540091b3
commit
3d14ca2c24
|
@ -37,7 +37,7 @@ class DiscussionTopic < ActiveRecord::Base
|
|||
include LockedFor
|
||||
|
||||
restrict_columns :content, [:title, :message]
|
||||
restrict_columns :settings, [:delayed_post_at, :require_initial_post, :discussion_type,
|
||||
restrict_columns :settings, [:delayed_post_at, :require_initial_post, :discussion_type, :assignment_id,
|
||||
:lock_at, :pinned, :locked, :allow_rating, :only_graders_can_rate, :sort_by_rating]
|
||||
restrict_columns :state, [:workflow_state]
|
||||
restrict_assignment_columns
|
||||
|
@ -272,7 +272,15 @@ class DiscussionTopic < ActiveRecord::Base
|
|||
end
|
||||
if @old_assignment_id
|
||||
Assignment.where(:id => @old_assignment_id, :context_id => self.context_id, :context_type => self.context_type, :submission_types => 'discussion_topic').update_all(:workflow_state => 'deleted', :updated_at => Time.now.utc)
|
||||
ContentTag.delete_for(Assignment.find(@old_assignment_id)) if @old_assignment_id
|
||||
old_assignment = Assignment.find(@old_assignment_id)
|
||||
ContentTag.delete_for(old_assignment)
|
||||
# prevent future syncs from recreating the deleted assignment
|
||||
if is_child_content?
|
||||
old_assignment.submission_types = 'none'
|
||||
context.master_course_subscriptions.each do |sub|
|
||||
sub.create_content_tag_for!(old_assignment, :downstream_changes => ['workflow_state'])
|
||||
end
|
||||
end
|
||||
elsif self.assignment && @saved_by != :assignment && !self.root_topic_id
|
||||
deleted_assignment = self.assignment.deleted?
|
||||
self.sync_assignment
|
||||
|
|
|
@ -1133,6 +1133,36 @@ describe MasterCourses::MasterMigration do
|
|||
expect(copied_topic_assmt.reload.due_at.to_i).to eq new_master_due_at.to_i
|
||||
end
|
||||
|
||||
it "allows a minion course's change of the graded status of a discussion topic to stick" do
|
||||
@copy_to = course_factory
|
||||
sub = @template.add_child_course!(@copy_to)
|
||||
|
||||
topic = @copy_from.discussion_topics.new
|
||||
topic.assignment = @copy_from.assignments.build(:due_at => 1.month.from_now)
|
||||
topic.save!
|
||||
run_master_migration
|
||||
|
||||
topic_to = @copy_to.discussion_topics.where(:migration_id => mig_id(topic)).take
|
||||
assignment_to = topic_to.assignment
|
||||
topic_to.assignment = nil
|
||||
topic_to.save!
|
||||
|
||||
expect(assignment_to.reload).to be_deleted
|
||||
topic_tag = MasterCourses::ChildContentTag.where(content_type: 'DiscussionTopic', content_id: topic_to.id).take
|
||||
expect(topic_tag.downstream_changes).to include 'assignment_id'
|
||||
assign_tag = MasterCourses::ChildContentTag.where(content_id: 'Assignment', content_id: assignment_to.id).take
|
||||
expect(assign_tag.downstream_changes).to include 'workflow_state'
|
||||
|
||||
Timecop.travel(1.hour.from_now) do
|
||||
topic.message = 'content updated'
|
||||
topic.save!
|
||||
end
|
||||
run_master_migration
|
||||
|
||||
expect(topic_to.reload.assignment).to be_nil
|
||||
expect(assignment_to.reload).to be_deleted
|
||||
end
|
||||
|
||||
it "should ignore course settings on selective export unless requested" do
|
||||
@copy_to = course_factory
|
||||
@sub = @template.add_child_course!(@copy_to)
|
||||
|
|
Loading…
Reference in New Issue