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
6432b35a
Commit
6432b35a
authored
12 years ago
by
Rocky Duan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
small fix & get rid of unnecessary comments in the code
parent
0fe7d2b7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
app.rb
+4
-4
No files found.
app.rb
View file @
6432b35a
...
...
@@ -29,7 +29,7 @@ get '/api/v1/:commentable_id/threads' do |commentable_id|
end
post
'/api/v1/:commentable_id/threads'
do
|
commentable_id
|
commentable
=
Commentable
.
find
(
commentable_id
)
#_or_create_by(commentable_type: commentable_type, commentable_id: commentable_id)
commentable
=
Commentable
.
find
(
commentable_id
)
thread
=
commentable
.
comment_threads
.
new
(
params
.
slice
(
*
%w[title body course_id]
))
thread
.
author
=
User
.
find_or_create_by
(
external_id:
params
[
"user_id"
])
if
params
[
"user_id"
]
thread
.
save!
...
...
@@ -119,7 +119,7 @@ post '/api/v1/users/:user_id/subscriptions' do |user_id|
when
"thread"
CommentThread
.
find
(
params
[
"source_id"
])
when
"other"
Commentable
.
find
(
params
[
"source_id"
])
#find_or_create_by(commentable_type: params["source_type"], commentable_id: params["source_id"])
Commentable
.
find
(
params
[
"source_id"
])
end
user
.
subscribe
(
source
).
to_hash
.
to_json
end
...
...
@@ -131,8 +131,8 @@ delete '/api/v1/users/:user_id/subscriptions' do |user_id|
User
.
find_or_create_by
(
external_id:
params
[
"source_id"
])
when
"thread"
CommentThread
.
find
(
params
[
"source_id"
])
else
Commentable
.
find
(
params
[
"source_id"
])
#find_or_create_by(commentable_type: params["source_type"], commentable_id: params["source_id"])
when
"other"
Commentable
.
find
(
params
[
"source_id"
])
end
user
.
unsubscribe
(
source
).
to_hash
.
to_json
end
...
...
This diff is collapsed.
Click to expand it.
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