Commit 8f5ebbd1b2016f491d463fd4ba398a547ba0f290

Authored by Rodrigo Souto
1 parent c05d4206

api: use visible_for_person instead of display_info_to

lib/noosfero/api/v1/communities.rb
@@ -42,10 +42,7 @@ module Noosfero @@ -42,10 +42,7 @@ module Noosfero
42 end 42 end
43 43
44 get ':id' do 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 present community, :with => Entities::Community 46 present community, :with => Entities::Community
50 end 47 end
51 48
lib/noosfero/api/v1/enterprises.rb
@@ -26,10 +26,7 @@ module Noosfero @@ -26,10 +26,7 @@ module Noosfero
26 26
27 desc "Return one enterprise by id" 27 desc "Return one enterprise by id"
28 get ':id' do 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 present enterprise, :with => Entities::Enterprise 30 present enterprise, :with => Entities::Enterprise
34 end 31 end
35 32