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
bd78a26d
Commit
bd78a26d
authored
Jun 21, 2012
by
Rocky Duan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
order comments by time
parent
685778b1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
5 deletions
+6
-5
models/comment.rb
+1
-1
spec/app_spec.rb
+5
-4
No files found.
models/comment.rb
View file @
bd78a26d
...
@@ -34,7 +34,7 @@ class Comment < ActiveRecord::Base
...
@@ -34,7 +34,7 @@ class Comment < ActiveRecord::Base
end
end
def
to_hash_tree
def
to_hash_tree
self
.
class
.
hash_tree
(
self
.
subtree
.
arrange
)
self
.
class
.
hash_tree
(
self
.
subtree
.
arrange
(
:order
=>
"updated_at DESC"
)
)
end
end
end
end
spec/app_spec.rb
View file @
bd78a26d
...
@@ -89,10 +89,11 @@ describe "app" do
...
@@ -89,10 +89,11 @@ describe "app" do
c
[
"created_at"
].
should_not
be_nil
c
[
"created_at"
].
should_not
be_nil
c
[
"updated_at"
].
should_not
be_nil
c
[
"updated_at"
].
should_not
be_nil
c
[
"children"
].
length
.
should
==
2
c
[
"children"
].
length
.
should
==
2
c
[
"children"
][
0
][
"title"
].
should
==
"comment title 0"
children
=
c
[
"children"
].
reject
{
|
comment
|
comment
[
"title"
]
!=
"comment title 0"
}.
first
c
[
"children"
][
0
][
"id"
].
should
==
sub_comment
[
0
].
id
children
.
should_not
be_nil
c
[
"children"
][
0
][
"created_at"
].
should_not
be_nil
children
[
"id"
].
should
==
sub_comment
[
0
].
id
c
[
"children"
][
0
][
"updated_at"
].
should_not
be_nil
children
[
"created_at"
].
should_not
be_nil
children
[
"updated_at"
].
should_not
be_nil
end
end
end
end
describe
"DELETE on /api/v1/commentables/:commentable_type/:commentable_id"
do
describe
"DELETE on /api/v1/commentables/:commentable_type/:commentable_id"
do
...
...
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