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
5122a9a6
Commit
5122a9a6
authored
Jun 25, 2012
by
Rocky Duan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changed level limit
parent
2dded1a2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
2 deletions
+2
-2
app.rb
+1
-1
config/application.yml
+1
-1
No files found.
app.rb
View file @
5122a9a6
...
@@ -50,7 +50,7 @@ post '/api/v1/comments/:comment_id' do |comment_id|
...
@@ -50,7 +50,7 @@ post '/api/v1/comments/:comment_id' do |comment_id|
comment
=
Comment
.
find_by_id
(
comment_id
)
comment
=
Comment
.
find_by_id
(
comment_id
)
if
comment
.
nil?
or
comment
.
is_root?
if
comment
.
nil?
or
comment
.
is_root?
error
400
,
{
:error
=>
"invalid comment id"
}.
to_json
error
400
,
{
:error
=>
"invalid comment id"
}.
to_json
elsif
comment
.
depth
-
1
>=
config
[
"depth_limit"
]
# The depth should be subtracted by 1 because we are counting the super comment
elsif
comment
.
depth
>=
config
[
"level_limit"
]
error
400
,
{
:error
=>
"depth limit exceeded"
}.
to_json
error
400
,
{
:error
=>
"depth limit exceeded"
}.
to_json
else
else
comment_params
=
params
.
select
{
|
key
,
value
|
%w{body title user_id course_id}
.
include?
key
}.
merge
({
:comment_thread_id
=>
comment
.
comment_thread_id
})
comment_params
=
params
.
select
{
|
key
,
value
|
%w{body title user_id course_id}
.
include?
key
}.
merge
({
:comment_thread_id
=>
comment
.
comment_thread_id
})
...
...
config/application.yml
View file @
5122a9a6
depth_limit
:
1
level_limit
:
3
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