Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cs_comments_service
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
cs_comments_service
Commits
76d71441
Commit
76d71441
authored
Aug 02, 2013
by
Your Name
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
keep flagged threads and comments out of digest
parent
fca509ab
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
23 deletions
+31
-23
lib/helpers.rb
+31
-23
No files found.
lib/helpers.rb
View file @
76d71441
...
...
@@ -233,31 +233,39 @@ helpers do
notification_map
=
{}
comments
.
each
do
|
c
|
user_ids
=
subscriptions_map
[
c
.
comment_thread_id
.
to_s
]
user_ids
.
each
do
|
u
|
if
not
notification_map
.
keys
.
include?
u
notification_map
[
u
]
=
{}
end
if
not
notification_map
[
u
].
keys
.
include?
c
.
course_id
notification_map
[
u
][
c
.
course_id
]
=
{}
end
current_thread
=
thread_map
[
c
.
comment_thread_id
]
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
[
"content"
]
=
[]
t
[
"title"
]
=
thread_map
[
c
.
comment_thread_id
].
title
t
[
"commentable_id"
]
=
thread_map
[
c
.
comment_thread_id
].
commentable_id
else
t
=
notification_map
[
u
][
c
.
course_id
][
c
.
comment_thread_id
.
to_s
]
#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
.
each
do
|
u
|
if
not
notification_map
.
keys
.
include?
u
notification_map
[
u
]
=
{}
end
if
not
notification_map
[
u
].
keys
.
include?
c
.
course_id
notification_map
[
u
][
c
.
course_id
]
=
{}
end
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
[
"content"
]
=
[]
t
[
"title"
]
=
current_thread
.
title
t
[
"commentable_id"
]
=
current_thread
.
commentable_id
else
t
=
notification_map
[
u
][
c
.
course_id
][
c
.
comment_thread_id
.
to_s
]
end
content_obj
=
{}
content_obj
[
"username"
]
=
c
.
author_with_anonymity
(
:username
,
"(anonymous)"
)
content_obj
[
"updated_at"
]
=
c
.
updated_at
content_obj
[
"body"
]
=
c
.
body
t
[
"content"
]
<<
content_obj
end
content_obj
=
{}
content_obj
[
"username"
]
=
c
.
author_with_anonymity
(
:username
,
"(anonymous)"
)
content_obj
[
"updated_at"
]
=
c
.
updated_at
content_obj
[
"body"
]
=
c
.
body
t
[
"content"
]
<<
content_obj
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment