Commit f0d49dcbb3cf8c20284177cebc6593583078da3e

Authored by Daniela Feitosa
Committed by Antonio Terceiro
1 parent de91cf8b

ActionItem1062: removing popup when community is not public

app/models/person.rb
... ... @@ -229,6 +229,7 @@ class Person < Profile
229 229 has_and_belongs_to_many :refused_communities, :class_name => 'Community', :join_table => 'refused_join_community'
230 230  
231 231 def ask_to_join?(community)
  232 + return false if !community.public_profile
232 233 return false if memberships.include?(community)
233 234 return false if AddMember.find(:first, :conditions => {:requestor_id => self.id, :target_id => community.id})
234 235 !refused_communities.include?(community)
... ...
test/unit/person_test.rb
... ... @@ -534,4 +534,10 @@ class PersonTest < Test::Unit::TestCase
534 534 assert !p.ask_to_join?(c)
535 535 end
536 536  
  537 + should 'not ask to join if community is not public' do
  538 + p = create_user('test_user').person
  539 + c = Community.create!(:name => 'Test community', :identifier => 'test_community', :public_profile => false)
  540 +
  541 + assert !p.ask_to_join?(c)
  542 + end
537 543 end
... ...