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
fdf017c9
Commit
fdf017c9
authored
May 26, 2015
by
Greg Price
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #128 from edx/gprice/thread-post-presenter
Use thread presenter in thread creation response
parents
ef94c213
93774c73
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
1 deletions
+6
-1
api/commentables.rb
+2
-1
spec/api/commentable_spec.rb
+4
-0
No files found.
api/commentables.rb
View file @
fdf017c9
...
@@ -41,6 +41,7 @@ post "#{APIPREFIX}/:commentable_id/threads" do |commentable_id|
...
@@ -41,6 +41,7 @@ post "#{APIPREFIX}/:commentable_id/threads" do |commentable_id|
error
400
,
thread
.
errors
.
full_messages
.
to_json
error
400
,
thread
.
errors
.
full_messages
.
to_json
else
else
user
.
subscribe
(
thread
)
if
bool_auto_subscribe
user
.
subscribe
(
thread
)
if
bool_auto_subscribe
thread
.
to_hash
.
to_json
presenter
=
ThreadPresenter
.
factory
(
thread
,
nil
)
presenter
.
to_hash
.
to_json
end
end
end
end
spec/api/commentable_spec.rb
View file @
fdf017c9
...
@@ -93,6 +93,10 @@ describe "app" do
...
@@ -93,6 +93,10 @@ describe "app" do
old_count
=
CommentThread
.
count
old_count
=
CommentThread
.
count
post
'/api/v1/question_1/threads'
,
default_params
post
'/api/v1/question_1/threads'
,
default_params
last_response
.
should
be_ok
last_response
.
should
be_ok
result
=
parse
(
last_response
.
body
)
result
[
"read"
].
should
==
false
result
[
"unread_comments_count"
].
should
==
0
result
[
"endorsed"
].
should
==
false
CommentThread
.
count
.
should
==
old_count
+
1
CommentThread
.
count
.
should
==
old_count
+
1
CommentThread
.
where
(
title:
"Interesting question"
).
first
.
should_not
be_nil
CommentThread
.
where
(
title:
"Interesting question"
).
first
.
should_not
be_nil
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