Commit f0d49dcbb3cf8c20284177cebc6593583078da3e
Committed by
Antonio Terceiro
1 parent
de91cf8b
Exists in
master
and in
28 other branches
ActionItem1062: removing popup when community is not public
Showing
2 changed files
with
7 additions
and
0 deletions
Show diff stats
app/models/person.rb
@@ -229,6 +229,7 @@ class Person < Profile | @@ -229,6 +229,7 @@ class Person < Profile | ||
229 | has_and_belongs_to_many :refused_communities, :class_name => 'Community', :join_table => 'refused_join_community' | 229 | has_and_belongs_to_many :refused_communities, :class_name => 'Community', :join_table => 'refused_join_community' |
230 | 230 | ||
231 | def ask_to_join?(community) | 231 | def ask_to_join?(community) |
232 | + return false if !community.public_profile | ||
232 | return false if memberships.include?(community) | 233 | return false if memberships.include?(community) |
233 | return false if AddMember.find(:first, :conditions => {:requestor_id => self.id, :target_id => community.id}) | 234 | return false if AddMember.find(:first, :conditions => {:requestor_id => self.id, :target_id => community.id}) |
234 | !refused_communities.include?(community) | 235 | !refused_communities.include?(community) |
test/unit/person_test.rb
@@ -534,4 +534,10 @@ class PersonTest < Test::Unit::TestCase | @@ -534,4 +534,10 @@ class PersonTest < Test::Unit::TestCase | ||
534 | assert !p.ask_to_join?(c) | 534 | assert !p.ask_to_join?(c) |
535 | end | 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 | end | 543 | end |