don't rename assignment to match subtopic; fixes #7357

test plan:
 * create a discussion assignment
 * edit the assignment, changing its name and making it
   a group assignment
 * ensure, after saving the assignment, that its name is not
   appended with a group name

Change-Id: I87806eba91888680c153c551a21d3829b3fe26e8
Reviewed-on: https://gerrit.instructure.com/10388
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
This commit is contained in:
Jeremy Stanley 2012-04-27 13:46:03 -06:00
parent 565aa5800d
commit 69aefd22a2
2 changed files with 8 additions and 1 deletions

View File

@ -140,7 +140,7 @@ class DiscussionTopic < ActiveRecord::Base
if @old_assignment_id
Assignment.update_all({:workflow_state => 'deleted', :updated_at => Time.now.utc}, {:id => @old_assignment_id, :context_id => self.context_id, :context_type => self.context_type, :submission_types => 'discussion_topic'})
ContentTag.delete_for(Assignment.find(@old_assignment_id)) if @old_assignment_id
elsif self.assignment && @saved_by != :assignment
elsif self.assignment && @saved_by != :assignment && !self.root_topic_id
self.assignment.title = self.title
self.assignment.description = self.message
self.assignment.submission_types = "discussion_topic"

View File

@ -264,6 +264,13 @@ describe DiscussionTopic do
@topic.save
subtopics.each {|st| st.reload.discussion_type.should == 'threaded' }
end
it "should not rename the assignment to match a subtopic" do
topic_for_group_assignment
original_name = @assignment.title
@assignment.reload
@assignment.title.should == original_name
end
end
context "root_topic?" do