From 720daa81435b4c632cdf7b64044cf1ee59af977a Mon Sep 17 00:00:00 2001 From: ThibG Date: Tue, 11 Dec 2018 19:18:29 +0100 Subject: Add instance-wide setting to disable profile directory (#9497) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add instance-wide setting to disable profile directory Fixes #9496 When the profile directory is disabled: - The “discoverable” setting is hidden from users - The “profile directory” link is not shown on public pages - /explore returns 404 * Move Setting.profile_directory check to a before_action filter --- app/controllers/directories_controller.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'app/controllers/directories_controller.rb') diff --git a/app/controllers/directories_controller.rb b/app/controllers/directories_controller.rb index 265fd5fab..b8565af4b 100644 --- a/app/controllers/directories_controller.rb +++ b/app/controllers/directories_controller.rb @@ -3,6 +3,7 @@ class DirectoriesController < ApplicationController layout 'public' + before_action :check_enabled before_action :set_instance_presenter before_action :set_tag, only: :show before_action :set_tags @@ -18,6 +19,10 @@ class DirectoriesController < ApplicationController private + def check_enabled + return not_found unless Setting.profile_directory + end + def set_tag @tag = Tag.discoverable.find_by!(name: params[:id].downcase) end -- cgit