diff --git a/app/controllers/my_profile/profile_editor_controller.rb b/app/controllers/my_profile/profile_editor_controller.rb index 691ee24..9a102a4 100644 --- a/app/controllers/my_profile/profile_editor_controller.rb +++ b/app/controllers/my_profile/profile_editor_controller.rb @@ -11,7 +11,7 @@ class ProfileEditorController < MyProfileController def index @pending_tasks = Task.to(profile).pending.without_spam.select{|i| user.has_permission?(i.permission, profile)} - @show_appearance_option = user.is_admin?(environment) || !environment.enabled?('disable_appearance') + @show_appearance_option = user.is_admin?(environment) || environment.enabled?('enable_appearance') @show_header_footer_option = user.is_admin?(environment) || (!profile.enterprise? && !environment.enabled?('disable_header_and_footer')) end diff --git a/app/controllers/themes_controller.rb b/app/controllers/themes_controller.rb index 8ad8b67..7973b47 100644 --- a/app/controllers/themes_controller.rb +++ b/app/controllers/themes_controller.rb @@ -43,8 +43,8 @@ class ThemesController < ApplicationController private def check_user_can_edit_appearance - user_can_not_edit_appearance = !user.is_admin?(environment) && environment.enabled?('disable_appearance') - redirect_to request.referer || "/" if user_can_not_edit_appearance + user_can_edit_appearance = user.is_admin?(environment) || environment.enabled?('enable_appearance') + redirect_to request.referer || "/" unless user_can_edit_appearance end end diff --git a/app/models/environment.rb b/app/models/environment.rb index 5b306ff..b4f1013 100644 --- a/app/models/environment.rb +++ b/app/models/environment.rb @@ -123,7 +123,6 @@ class Environment < ActiveRecord::Base 'disable_asset_events' => _('Disable search for events'), 'disable_categories' => _('Disable categories'), 'disable_header_and_footer' => _('Disable header/footer editing by users'), - 'disable_appearance' => _('Disable appearance editing by users'), 'disable_gender_icon' => _('Disable gender icon'), 'disable_categories_menu' => _('Disable the categories menu'), 'disable_select_city_for_contact' => _('Disable state/city select for contact form'), @@ -160,6 +159,8 @@ class Environment < ActiveRecord::Base 'display_my_communities_on_user_menu' => _('Display on menu the list of communities the user can manage'), 'display_my_enterprises_on_user_menu' => _('Display on menu the list of enterprises the user can manage'), 'restrict_to_members' => _('Show content only to members'), + + 'enable_appearance' => _('Enable appearance editing by users'), } end @@ -439,6 +440,7 @@ class Environment < ActiveRecord::Base show_balloon_with_profile_links_when_clicked show_zoom_button_on_article_images use_portal_community + enable_appearance ) before_create :enable_default_features diff --git a/test/functional/profile_themes_controller_test.rb b/test/functional/profile_themes_controller_test.rb index fa743d6..4601f52 100644 --- a/test/functional/profile_themes_controller_test.rb +++ b/test/functional/profile_themes_controller_test.rb @@ -17,6 +17,7 @@ class ProfileThemesControllerTest < ActionController::TestCase @env = Environment.default @env.enable('user_themes') + @env.enable_default_features @env.save! end attr_reader :profile, :env @@ -331,7 +332,7 @@ class ProfileThemesControllerTest < ActionController::TestCase should 'user cant edit appearance if environment dont permit' do environment = Environment.default - environment.settings[:disable_appearance_enabled] = true + environment.disable('enable_appearance') environment.save! user = create_user('user').person @@ -346,7 +347,7 @@ class ProfileThemesControllerTest < ActionController::TestCase environment = Environment.default environment.add_admin(user) - environment.settings[:disable_appearance_enabled] = true + environment.disable('enable_appearance') environment.save! login_as('user') -- libgit2 0.21.2