show unread indicator for graded discussion topic stream items

test plan:
* create a course with a student
* create and publish a graded discussion topic
* the topic should show in the student's "Recent Activity" stream
 with an unread indicator (blue dot)

closes #CNVS-30538

Change-Id: Id295c3f67ead51938f9b7a48bfb0db1c4e67b920
Reviewed-on: https://gerrit.instructure.com/87647
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
This commit is contained in:
James Williams 2016-08-12 10:22:19 -06:00
parent 32952f8e5b
commit e8e6b335e8
2 changed files with 11 additions and 4 deletions

View File

@ -662,8 +662,6 @@ class DiscussionTopic < ActiveRecord::Base
false
elsif self.root_topic_id && self.has_group_category?
false
elsif self.assignment && self.assignment.submission_types == 'discussion_topic' && (!self.assignment.due_at || self.assignment.due_at > 1.week.from_now) # TODO: vdd
false
else
true
end
@ -950,7 +948,7 @@ class DiscussionTopic < ActiveRecord::Base
def active_participants_with_visibility
return active_participants if !self.for_assignment?
users_with_visibility = AssignmentStudentVisibility.where(assignment_id: self.assignment_id, course_id: course.id).pluck(:user_id)
users_with_visibility = self.assignment.students_with_visibility.pluck(:id)
admin_ids = course.participating_admins.pluck(:id)
users_with_visibility.concat(admin_ids)
@ -975,7 +973,7 @@ class DiscussionTopic < ActiveRecord::Base
subscribed_users = participating_users(sub_ids).to_a
if self.for_assignment?
students_with_visibility = AssignmentStudentVisibility.where(course_id: course.id, assignment_id: assignment_id).pluck(:user_id)
students_with_visibility = self.assignment.students_with_visibility.pluck(:id)
admin_ids = course.participating_admins.pluck(:id)
observer_ids = course.participating_observers.pluck(:id)

View File

@ -822,6 +822,15 @@ describe DiscussionTopic do
expect(@teacher.stream_item_instances.count).to eq 1
end
it "should send stream items to students for graded discussions" do
@topic = @course.discussion_topics.build(:title => "topic")
@assignment = @course.assignments.build(:submission_types => 'discussion_topic', :title => @topic.title)
@assignment.saved_by = :discussion_topic
@topic.assignment = @assignment
@topic.save
expect(@student.stream_item_instances.count).to eq 1
end
end
context "posting first to view" do