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
266b9a4d
Commit
266b9a4d
authored
Aug 05, 2012
by
Rocky Duan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
entry for whether thread is closed
parent
4fd9756b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
2 deletions
+4
-2
models/comment.rb
+1
-0
models/comment_thread.rb
+3
-2
No files found.
models/comment.rb
View file @
266b9a4d
...
...
@@ -52,6 +52,7 @@ class Comment < Content
.
merge
(
"user_id"
=>
author
.
id
)
.
merge
(
"username"
=>
author
.
username
)
.
merge
(
"depth"
=>
depth
)
.
merge
(
"closed"
=>
comment_thread
.
closed
)
.
merge
(
"thread_id"
=>
comment_thread
.
id
)
.
merge
(
"votes"
=>
votes
.
slice
(
*
%w[count up_count down_count point]
))
end
...
...
models/comment_thread.rb
View file @
266b9a4d
...
...
@@ -13,6 +13,7 @@ class CommentThread < Content
field
:course_id
,
type:
String
field
:commentable_id
,
type:
String
field
:anonymous
,
type:
Boolean
,
default:
false
field
:closed
,
type:
Boolean
,
default:
false
field
:at_position_list
,
type:
Array
,
default:
[]
field
:last_activity_at
,
type:
Time
...
...
@@ -42,7 +43,7 @@ class CommentThread < Content
belongs_to
:author
,
class_name:
"User"
,
inverse_of: :comment_threads
,
index:
true
#, autosave: true
has_many
:comments
,
dependent: :destroy
#, autosave: true# Use destroy to envoke callback on the top-level comments TODO async
attr_accessible
:title
,
:body
,
:course_id
,
:commentable_id
,
:anonymous
attr_accessible
:title
,
:body
,
:course_id
,
:commentable_id
,
:anonymous
,
:closed
validates_presence_of
:title
validates_presence_of
:body
...
...
@@ -86,7 +87,7 @@ class CommentThread < Content
end
def
to_hash
(
params
=
{})
doc
=
as_document
.
slice
(
*
%w[title body course_id anonymous commentable_id created_at updated_at at_position_list]
)
doc
=
as_document
.
slice
(
*
%w[title body course_id anonymous commentable_id created_at updated_at at_position_list
closed
]
)
.
merge
(
"id"
=>
_id
)
.
merge
(
"user_id"
=>
author
.
id
)
.
merge
(
"username"
=>
author
.
username
)
...
...
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