Commit 638d29b1f194db6dc4cf84e4b0a4bb37051b29ed
Committed by
Leandro Santos
1 parent
410aa5af
Exists in
staging
and in
31 other branches
get list visible communities, enterprises & people
Showing
4 changed files
with
9 additions
and
5 deletions
Show diff stats
lib/noosfero/api/v1/communities.rb
... | ... | @@ -49,7 +49,7 @@ module Noosfero |
49 | 49 | end |
50 | 50 | |
51 | 51 | get ':id' do |
52 | - community = environment.communities.visible_for_person(current_person).find_by id: params[:id] | |
52 | + community = environment.communities.visible..find_by(id: params[:id]) | |
53 | 53 | present community, :with => Entities::Community, :current_person => current_person |
54 | 54 | end |
55 | 55 | ... | ... |
lib/noosfero/api/v1/enterprises.rb
... | ... | @@ -26,7 +26,7 @@ module Noosfero |
26 | 26 | |
27 | 27 | desc "Return one enterprise by id" |
28 | 28 | get ':id' do |
29 | - enterprise = environment.enterprises.visible_for_person(current_person).find_by id: params[:id] | |
29 | + enterprise = environment.enterprises.visible.find_by(id: params[:id]) | |
30 | 30 | present enterprise, :with => Entities::Enterprise, :current_person => current_person |
31 | 31 | end |
32 | 32 | ... | ... |
lib/noosfero/api/v1/people.rb
... | ... | @@ -46,7 +46,7 @@ module Noosfero |
46 | 46 | |
47 | 47 | desc "Return the person information" |
48 | 48 | get ':id' do |
49 | - person = environment.people.visible_for_person(current_person).find_by id: params[:id] | |
49 | + person = environment.people.visible.find_by(id: params[:id]) | |
50 | 50 | return not_found! if person.blank? |
51 | 51 | present person, :with => Entities::Person, :current_person => current_person |
52 | 52 | end |
... | ... | @@ -87,7 +87,11 @@ module Noosfero |
87 | 87 | |
88 | 88 | desc "Return the person friends" |
89 | 89 | get ':id/friends' do |
90 | +<<<<<<< HEAD | |
90 | 91 | person = environment.people.visible_for_person(current_person).find_by id: params[:id] |
92 | +======= | |
93 | + person = environment.people.visible.find_by_id(params[:id]) | |
94 | +>>>>>>> get list visible communities, enterprises & people | |
91 | 95 | return not_found! if person.blank? |
92 | 96 | friends = person.friends.visible |
93 | 97 | present friends, :with => Entities::Person, :current_person => current_person | ... | ... |
test/api/people_test.rb
... | ... | @@ -96,12 +96,12 @@ class PeopleTest < ActiveSupport::TestCase |
96 | 96 | assert json['person'].blank? |
97 | 97 | end |
98 | 98 | |
99 | - should 'not get private people without permission' do | |
99 | + should 'get private people' do | |
100 | 100 | private_person = fast_create(Person, :public_profile => false) |
101 | 101 | |
102 | 102 | get "/api/v1/people/#{private_person.id}?#{params.to_query}" |
103 | 103 | json = JSON.parse(last_response.body) |
104 | - assert json['person'].blank? | |
104 | + assert_equal json['person']['id'], private_person.id | |
105 | 105 | end |
106 | 106 | |
107 | 107 | should 'get private person for friends' do | ... | ... |