Commit 8f5ebbd1b2016f491d463fd4ba398a547ba0f290
1 parent
c05d4206
Exists in
master
and in
29 other branches
api: use visible_for_person instead of display_info_to
Showing
2 changed files
with
2 additions
and
8 deletions
Show diff stats
lib/noosfero/api/v1/communities.rb
... | ... | @@ -42,10 +42,7 @@ module Noosfero |
42 | 42 | end |
43 | 43 | |
44 | 44 | get ':id' do |
45 | - community = environment.communities.find_by_id(params[:id]) | |
46 | - unless community.nil? | |
47 | - community = nil unless community.display_info_to?(current_person) | |
48 | - end | |
45 | + community = environment.communities.visible_for_person(current_person).find_by_id(params[:id]) | |
49 | 46 | present community, :with => Entities::Community |
50 | 47 | end |
51 | 48 | ... | ... |
lib/noosfero/api/v1/enterprises.rb
... | ... | @@ -26,10 +26,7 @@ module Noosfero |
26 | 26 | |
27 | 27 | desc "Return one enterprise by id" |
28 | 28 | get ':id' do |
29 | - enterprise = environment.enterprises.find_by_id(params[:id]) | |
30 | - unless enterprise.nil? | |
31 | - enterprise = nil unless enterprise.display_info_to?(current_person) | |
32 | - end | |
29 | + enterprise = environment.enterprises.visible_for_person(current_person).find_by_id(params[:id]) | |
33 | 30 | present enterprise, :with => Entities::Enterprise |
34 | 31 | end |
35 | 32 | ... | ... |