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
f03ea737
Commit
f03ea737
authored
Aug 01, 2016
by
Toby Lawrence
Committed by
GitHub
Aug 01, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into bbeggs/revert-context-migration
parents
1f6978cc
c309a7de
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
3 deletions
+38
-3
Gemfile.lock
+1
-1
models/comment.rb
+8
-1
presenters/thread_utils.rb
+4
-1
spec/models/comment_spec.rb
+25
-0
No files found.
Gemfile.lock
View file @
f03ea737
...
...
@@ -90,7 +90,7 @@ GEM
rake
multi_json (1.11.2)
netrc (0.10.3)
newrelic_rpm (3.1
5.0.314
)
newrelic_rpm (3.1
6.0.318
)
nokogiri (1.6.8)
mini_portile2 (~> 2.1.0)
pkg-config (~> 1.1.7)
...
...
models/comment.rb
View file @
f03ea737
...
...
@@ -141,7 +141,14 @@ class Comment < Content
end
def
context
self
.
comment_thread_id
?
self
.
comment_thread
.
context
:
nil
if
self
.
comment_thread_id
t
=
CommentThread
.
find
self
.
comment_thread_id
if
t
t
.
context
end
end
rescue
Mongoid
::
Errors
::
DocumentNotFound
nil
end
def
course_context?
...
...
presenters/thread_utils.rb
View file @
f03ea737
require
'new_relic/agent/method_tracer'
module
ThreadUtils
def
self
.
get_endorsed
(
threads
)
...
...
@@ -39,9 +41,10 @@ module ThreadUtils
read_states
end
extend
self
class
<<
self
include
::
NewRelic
::
Agent
::
MethodTracer
add_method_tracer
:get_read_states
add_method_tracer
:get_endorsed
end
end
spec/models/comment_spec.rb
View file @
f03ea737
...
...
@@ -36,6 +36,14 @@ describe Comment do
expect
(
comment
.
context
).
to
eq
(
"course"
)
end
end
context
'without valid parent thread'
do
it
'returns nil'
do
comment
=
make_comment
(
author
,
course_thread
,
"comment"
)
comment
.
comment_thread_id
=
'not a thread'
expect
(
comment
.
context
).
to
eq
(
nil
)
end
end
end
describe
'#course_context?'
do
...
...
@@ -52,6 +60,14 @@ describe Comment do
expect
(
comment
.
course_context?
).
to
be_true
end
end
context
'without valid parent thread'
do
it
'returns false'
do
comment
=
make_comment
(
author
,
course_thread
,
"comment"
)
comment
.
comment_thread_id
=
'not a thread'
expect
(
comment
.
course_context?
).
to
be_false
end
end
end
describe
'#standalone_context?'
do
...
...
@@ -68,6 +84,15 @@ describe Comment do
expect
(
comment
.
standalone_context?
).
to
be_false
end
end
context
'without valid parent thread'
do
it
'returns false'
do
comment
=
make_comment
(
author
,
course_thread
,
"comment"
)
comment
.
comment_thread_id
=
'not a thread'
expect
(
comment
.
standalone_context?
).
to
be_false
end
end
end
describe
'#child_count'
do
...
...
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