Commit c3308c853dc7902bb644a2eb6b28b4833bdb691e

Authored by Daniela Feitosa
1 parent 0fbd1b38

Changed a setting name to be less confusing

(ActionItem2901)
app/helpers/application_helper.rb
@@ -1139,7 +1139,7 @@ module ApplicationHelper @@ -1139,7 +1139,7 @@ module ApplicationHelper
1139 end 1139 end
1140 1140
1141 def manage_communities 1141 def manage_communities
1142 - return unless user && !user.environment.enabled?('disable_my_communities_menu') 1142 + return unless user && user.environment.enabled?('display_my_communities_on_user_menu')
1143 administered_communities = user.communities.more_popular.select {|c| c.admins.include? user} 1143 administered_communities = user.communities.more_popular.select {|c| c.admins.include? user}
1144 manage_link(administered_communities, :communities) 1144 manage_link(administered_communities, :communities)
1145 end 1145 end
app/models/environment.rb
@@ -97,7 +97,6 @@ class Environment < ActiveRecord::Base @@ -97,7 +97,6 @@ class Environment < ActiveRecord::Base
97 'disable_asset_events' => _('Disable search for events'), 97 'disable_asset_events' => _('Disable search for events'),
98 'disable_categories' => _('Disable categories'), 98 'disable_categories' => _('Disable categories'),
99 'disable_header_and_footer' => _('Disable header/footer editing by users'), 99 'disable_header_and_footer' => _('Disable header/footer editing by users'),
100 - 'disable_my_communities_menu' => _('Disable My Communities menu'),  
101 'disable_gender_icon' => _('Disable gender icon'), 100 'disable_gender_icon' => _('Disable gender icon'),
102 'disable_categories_menu' => _('Disable the categories menu'), 101 'disable_categories_menu' => _('Disable the categories menu'),
103 'disable_select_city_for_contact' => _('Disable state/city select for contact form'), 102 'disable_select_city_for_contact' => _('Disable state/city select for contact form'),
@@ -128,7 +127,8 @@ class Environment < ActiveRecord::Base @@ -128,7 +127,8 @@ class Environment < ActiveRecord::Base
128 'captcha_for_logged_users' => _('Ask captcha when a logged user comments too'), 127 'captcha_for_logged_users' => _('Ask captcha when a logged user comments too'),
129 'skip_new_user_email_confirmation' => _('Skip e-mail confirmation for new users'), 128 'skip_new_user_email_confirmation' => _('Skip e-mail confirmation for new users'),
130 'send_welcome_email_to_new_users' => _('Send welcome e-mail to new users'), 129 'send_welcome_email_to_new_users' => _('Send welcome e-mail to new users'),
131 - 'allow_change_of_redirection_after_login' => _('Allow users to set the page to redirect after login') 130 + 'allow_change_of_redirection_after_login' => _('Allow users to set the page to redirect after login'),
  131 + 'display_my_communities_on_user_menu' => _('Display on menu the list of communities the user can manage')
132 } 132 }
133 end 133 end
134 134
test/functional/profile_controller_test.rb
@@ -1549,16 +1549,45 @@ class ProfileControllerTest < ActionController::TestCase @@ -1549,16 +1549,45 @@ class ProfileControllerTest < ActionController::TestCase
1549 assert_tag :tag => 'td', :content => 'e-Mail:' 1549 assert_tag :tag => 'td', :content => 'e-Mail:'
1550 end 1550 end
1551 1551
1552 - should 'build menu to the community panel if enabled' do 1552 + should 'not display list of communities to manage on menu by default' do
  1553 + user = create_user('community_admin').person
  1554 + community = fast_create(Community)
  1555 + community.add_admin(user)
  1556 +
  1557 + login_as(user.identifier)
  1558 + get :index
  1559 + assert_no_tag :tag => 'div', :attributes => {:id => 'manage-communities'}
  1560 + end
  1561 +
  1562 + should 'display list of communities to manage on menu if enabled' do
  1563 + user = create_user('community_admin').person
  1564 + env = user.environment
  1565 + community = fast_create(Community)
  1566 + community.add_admin(user)
  1567 +
  1568 + Environment.any_instance.stubs(:enabled?).returns(false)
  1569 + Environment.any_instance.stubs(:enabled?).with('display_my_communities_on_user_menu').returns(true)
  1570 +
  1571 + login_as(user.identifier)
  1572 + get :index
  1573 + assert_tag :tag => 'div', :attributes => {:id => 'manage-communities'}
  1574 +
  1575 + end
  1576 +
  1577 + should 'build menu to the community panel of communities the user can manage if enabled' do
1553 u = create_user('other_other_ze').person 1578 u = create_user('other_other_ze').person
1554 u2 = create_user('guy_that_will_be_admin_of_all').person # because the first member of each community is an admin 1579 u2 = create_user('guy_that_will_be_admin_of_all').person # because the first member of each community is an admin
  1580 +
  1581 + Environment.any_instance.stubs(:enabled?).returns(false)
  1582 + Environment.any_instance.stubs(:enabled?).with('display_my_communities_on_user_menu').returns(true)
  1583 +
1555 Environment.any_instance.stubs(:required_person_fields).returns([]) 1584 Environment.any_instance.stubs(:required_person_fields).returns([])
1556 u.data = { :email => 'test@test.com', :fields_privacy => { } } 1585 u.data = { :email => 'test@test.com', :fields_privacy => { } }
1557 u.save! 1586 u.save!
1558 - c1 = Community.create!(:name => 'community_1')  
1559 - c2 = Community.create!(:name => 'community_2')  
1560 - c3 = Community.create!(:name => 'community_3')  
1561 - c4 = Community.create!(:name => 'community_4') 1587 + c1 = fast_create(Community, :name => 'community_1')
  1588 + c2 = fast_create(Community, :name => 'community_2')
  1589 + c3 = fast_create(Community, :name => 'community_3')
  1590 + c4 = fast_create(Community, :name => 'community_4')
1562 1591
1563 c1.add_admin(u2) 1592 c1.add_admin(u2)
1564 c2.add_admin(u2) 1593 c2.add_admin(u2)
@@ -1582,12 +1611,6 @@ class ProfileControllerTest < ActionController::TestCase @@ -1582,12 +1611,6 @@ class ProfileControllerTest < ActionController::TestCase
1582 assert_no_match /community_3/, links.to_s 1611 assert_no_match /community_3/, links.to_s
1583 assert_no_match /community_4/, links.to_s 1612 assert_no_match /community_4/, links.to_s
1584 end 1613 end
1585 -  
1586 - Environment.any_instance.stubs(:enabled?).returns(false)  
1587 - Environment.any_instance.stubs(:enabled?).with('disable_my_communities_menu').returns(true)  
1588 -  
1589 - get :index  
1590 - assert_no_tag :tag => 'div', :attributes => {:id => 'manage-communities'}  
1591 end 1614 end
1592 1615
1593 should 'build menu to the enterprise panel' do 1616 should 'build menu to the enterprise panel' do