Commit 055920fc17d0c374ad18edb6b68bb4e2a913dfe6
1 parent
043be0b1
Exists in
web_steps_improvements
and in
6 other branches
api: expose replies of a comment
Showing
1 changed file
with
7 additions
and
2 deletions
Show diff stats
lib/noosfero/api/entities.rb
| ... | ... | @@ -183,11 +183,16 @@ module Noosfero |
| 183 | 183 | expose :children, :using => ArticleBase |
| 184 | 184 | end |
| 185 | 185 | |
| 186 | - class Comment < Entity | |
| 187 | - root 'comments', 'comment' | |
| 186 | + class CommentBase < Entity | |
| 188 | 187 | expose :body, :title, :id |
| 189 | 188 | expose :created_at, :format_with => :timestamp |
| 190 | 189 | expose :author, :using => Profile |
| 190 | + expose :reply_of, :using => CommentBase | |
| 191 | + end | |
| 192 | + | |
| 193 | + class Comment < CommentBase | |
| 194 | + root 'comments', 'comment' | |
| 195 | + expose :children, as: :replies, :using => Comment | |
| 191 | 196 | end |
| 192 | 197 | |
| 193 | 198 | class User < Entity | ... | ... |