From f0d49dcbb3cf8c20284177cebc6593583078da3e Mon Sep 17 00:00:00 2001 From: Daniela Soares Feitosa Date: Thu, 28 May 2009 15:54:35 -0300 Subject: [PATCH] ActionItem1062: removing popup when community is not public --- app/models/person.rb | 1 + test/unit/person_test.rb | 6 ++++++ 2 files changed, 7 insertions(+), 0 deletions(-) diff --git a/app/models/person.rb b/app/models/person.rb index df0b484..986f1e5 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -229,6 +229,7 @@ class Person < Profile has_and_belongs_to_many :refused_communities, :class_name => 'Community', :join_table => 'refused_join_community' def ask_to_join?(community) + return false if !community.public_profile return false if memberships.include?(community) return false if AddMember.find(:first, :conditions => {:requestor_id => self.id, :target_id => community.id}) !refused_communities.include?(community) diff --git a/test/unit/person_test.rb b/test/unit/person_test.rb index 1e26eaa..4dbaa98 100644 --- a/test/unit/person_test.rb +++ b/test/unit/person_test.rb @@ -534,4 +534,10 @@ class PersonTest < Test::Unit::TestCase assert !p.ask_to_join?(c) end + should 'not ask to join if community is not public' do + p = create_user('test_user').person + c = Community.create!(:name => 'Test community', :identifier => 'test_community', :public_profile => false) + + assert !p.ask_to_join?(c) + end end -- libgit2 0.21.2