Commit 0d57b23f2c6a71f9056d58acaf355429e69df3a2
1 parent
5c39797b
Exists in
staging
and in
4 other branches
api: expose entities related to activity
Showing
1 changed file
with
5 additions
and
0 deletions
Show diff stats
lib/noosfero/api/entities.rb
... | ... | @@ -239,6 +239,11 @@ module Noosfero |
239 | 239 | class Activity < Entity |
240 | 240 | root 'activities', 'activity' |
241 | 241 | expose :id, :params, :verb, :created_at, :updated_at, :comments_count, :visible |
242 | + expose :user, :using => Profile | |
243 | + expose :target do |activity, opts| | |
244 | + type_map = {Profile => ::Profile, ArticleBase => ::Article}.find {|h| activity.target.kind_of?(h.last)} | |
245 | + type_map.first.represent(activity.target) unless type_map.nil? | |
246 | + end | |
242 | 247 | end |
243 | 248 | |
244 | 249 | end | ... | ... |