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
5e13292e
Commit
5e13292e
authored
Jun 09, 2015
by
Greg Price
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #129 from edx/gprice/comment-return-parent-id
Return comment parent_id field
parents
fdf017c9
04878910
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
0 deletions
+3
-0
models/comment.rb
+1
-0
spec/api/comment_spec.rb
+2
-0
No files found.
models/comment.rb
View file @
5e13292e
...
...
@@ -102,6 +102,7 @@ class Comment < Content
.
merge
(
"depth"
=>
depth
)
.
merge
(
"closed"
=>
comment_thread
.
nil?
?
false
:
comment_thread
.
closed
)
# ditto
.
merge
(
"thread_id"
=>
comment_thread_id
)
.
merge
(
"parent_id"
=>
parent_ids
[
-
1
])
.
merge
(
"commentable_id"
=>
comment_thread
.
nil?
?
nil
:
comment_thread
.
commentable_id
)
# ditto
.
merge
(
"votes"
=>
votes
.
slice
(
*
%w[count up_count down_count point]
))
.
merge
(
"abuse_flaggers"
=>
abuse_flaggers
)
...
...
spec/api/comment_spec.rb
View file @
5e13292e
...
...
@@ -25,6 +25,7 @@ describe "app" do
retrieved
[
"children"
].
should
be_nil
retrieved
[
"votes"
][
"point"
].
should
==
comment
.
votes_point
retrieved
[
"depth"
].
should
==
comment
.
depth
retrieved
[
"parent_id"
].
should
==
comment
.
parent_ids
[
-
1
]
end
it
"retrieve information of a single comment with its sub comments"
do
comment
=
Comment
.
first
...
...
@@ -37,6 +38,7 @@ describe "app" do
retrieved
[
"votes"
][
"point"
].
should
==
comment
.
votes_point
retrieved
[
"children"
].
length
.
should
==
comment
.
children
.
length
retrieved
[
"children"
].
select
{
|
c
|
c
[
"body"
]
==
comment
.
children
.
first
.
body
}.
first
.
should_not
be_nil
retrieved
[
"children"
].
each
{
|
c
|
c
[
"parent_id"
].
should
==
comment
.
id
.
to_s
}
end
it
"returns 400 when the comment does not exist"
do
get
"/api/v1/comments/does_not_exist"
...
...
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