submission comment inbox_item cleanup

Change-Id: Id16c68de3d90f56285ad0dcdb785746f713f5ae3
Reviewed-on: https://gerrit.instructure.com/5123
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Whitmer <brian@instructure.com>
This commit is contained in:
Jon Jensen 2011-08-17 13:32:40 -06:00
parent 3c9498cb5f
commit d2f04c94da
3 changed files with 2 additions and 39 deletions

View File

@ -17,7 +17,6 @@
#
class SubmissionComment < ActiveRecord::Base
include SendToInbox
include SendToStream
belongs_to :submission #, :touch => true
@ -58,24 +57,6 @@ class SubmissionComment < ActiveRecord::Base
has_a_broadcast_policy
on_create_send_to_inboxes do
if self.submission
users = []
if self.author_id == self.submission.user_id
users = self.submission.context.admins_in_charge_of(self.author_id)
else
users = self.submission.user_id
end
submission = self.submission
{
:recipients => users,
:subject => "#{submission.assignment.title}: #{submission.user.name}",
:body => self.comment,
:sender => self.author_id
}
end
end
def media_comment?
self.media_comment_id && self.media_comment_type
end

View File

@ -207,8 +207,8 @@ class MessageMigration < ActiveRecord::Migration
SQL
# hide inbox_items from the users
execute "UPDATE inbox_items SET workflow_state = 'retired' WHERE asset_type = 'ContextMessage' AND workflow_state = 'read'"
execute "UPDATE inbox_items SET workflow_state = 'retired_unread' WHERE asset_type = 'ContextMessage' AND workflow_state = 'unread'"
execute "UPDATE inbox_items SET workflow_state = 'retired' WHERE asset_type IN ('ContextMessage', 'SubmissionComment') AND workflow_state = 'read'"
execute "UPDATE inbox_items SET workflow_state = 'retired_unread' WHERE asset_type = ('ContextMessage', 'SubmissionComment') AND workflow_state = 'unread'"
execute <<-SQL

View File

@ -159,24 +159,6 @@ This text has a http://www.google.com link in it...
@item.data.submission_comments[0].formatted_body.should eql(@comment.formatted_body(250))
end
it "should send the comment to inbox" do
assignment_model
@assignment.workflow_state = 'published'
@assignment.save
@course.offer
te = @course.enroll_teacher(@user)
se = @course.enroll_student(user)
@assignment.reload
@submission = @assignment.submit_homework(se.user, :body => 'some message')
@submission.created_at = Time.now - 60
@submission.save
@comment = @submission.add_comment(:author => se.user, :comment => "some comment")
ii = InboxItem.last
ii.asset.should == @submission.submission_comments.last
ii.sender_id.should == se.user_id
ii.user_id.should == te.user_id
end
it "should not generate a conversation message when created by the submission_owner" do
old_count = ConversationMessage.count
SubmissionComment.create(@valid_attributes.merge(:author => @user))