Commit 97ec44df18b69e85501c1f73e4f5b15e4301692f
Exists in
staging
and in
4 other branches
Merge branch 'stable' of gitlab.com:participa/noosfero into stable
Showing
2 changed files
with
3 additions
and
2 deletions
Show diff stats
lib/noosfero/api/entities.rb
| @@ -68,7 +68,8 @@ module Noosfero | @@ -68,7 +68,8 @@ module Noosfero | ||
| 68 | expose :created_by, :as => :author, :using => Profile | 68 | expose :created_by, :as => :author, :using => Profile |
| 69 | expose :profile, :using => Profile | 69 | expose :profile, :using => Profile |
| 70 | expose :categories, :using => Category | 70 | expose :categories, :using => Category |
| 71 | - expose :parent, :using => Article | 71 | + # FIXME: create a method that overrides expose and include conditions for return attributes |
| 72 | + expose :parent, :using => Article, :if => lambda { |article, options| options[:fields].blank? || options[:fields].include?(:parent) } | ||
| 72 | expose :children, :using => ArticleChild | 73 | expose :children, :using => ArticleChild |
| 73 | expose :image, :using => Image | 74 | expose :image, :using => Image |
| 74 | end | 75 | end |
lib/noosfero/api/v1/articles.rb
| @@ -42,7 +42,7 @@ module Noosfero | @@ -42,7 +42,7 @@ module Noosfero | ||
| 42 | article = find_article(environment.articles, params[:id]) | 42 | article = find_article(environment.articles, params[:id]) |
| 43 | articles = select_filtered_collection_of(article, 'children', params) | 43 | articles = select_filtered_collection_of(article, 'children', params) |
| 44 | articles = articles.display_filter(current_person, nil) | 44 | articles = articles.display_filter(current_person, nil) |
| 45 | - present articles, :with => Entities::Article | 45 | + present articles, :with => Entities::Article, :fields => [:id, :name, :abstract, :author] |
| 46 | end | 46 | end |
| 47 | 47 | ||
| 48 | get ':id/children/:child_id' do | 48 | get ':id/children/:child_id' do |