Commit 76d71441 by Your Name

keep flagged threads and comments out of digest

parent fca509ab
...@@ -233,6 +233,14 @@ helpers do ...@@ -233,6 +233,14 @@ helpers do
notification_map = {} notification_map = {}
comments.each do |c| comments.each do |c|
current_thread = thread_map[c.comment_thread_id]
#do not include threads or comments who have current or historical abuse flags
if current_thread.abuse_flaggers.to_a.empty? and
current_thread.historical_abuse_flaggers.to_a.empty? and
c.abuse_flaggers.to_a.empty? and
c.historical_abuse_flaggers.to_a.empty?
user_ids = subscriptions_map[c.comment_thread_id.to_s] user_ids = subscriptions_map[c.comment_thread_id.to_s]
user_ids.each do |u| user_ids.each do |u|
if not notification_map.keys.include? u if not notification_map.keys.include? u
...@@ -246,8 +254,8 @@ helpers do ...@@ -246,8 +254,8 @@ helpers do
if not notification_map[u][c.course_id].include? c.comment_thread_id.to_s if not notification_map[u][c.course_id].include? c.comment_thread_id.to_s
t = notification_map[u][c.course_id][c.comment_thread_id.to_s] = {} t = notification_map[u][c.course_id][c.comment_thread_id.to_s] = {}
t["content"] = [] t["content"] = []
t["title"] = thread_map[c.comment_thread_id].title t["title"] = current_thread.title
t["commentable_id"] = thread_map[c.comment_thread_id].commentable_id t["commentable_id"] = current_thread.commentable_id
else else
t = notification_map[u][c.course_id][c.comment_thread_id.to_s] t = notification_map[u][c.course_id][c.comment_thread_id.to_s]
end end
...@@ -257,7 +265,7 @@ helpers do ...@@ -257,7 +265,7 @@ helpers do
content_obj["updated_at"] = c.updated_at content_obj["updated_at"] = c.updated_at
content_obj["body"] = c.body content_obj["body"] = c.body
t["content"] << content_obj t["content"] << content_obj
end
end end
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment