diff --git a/app/controllers/discover_controller.rb b/app/controllers/discover_controller.rb index dc553544..3f7d0c41 100644 --- a/app/controllers/discover_controller.rb +++ b/app/controllers/discover_controller.rb @@ -2,6 +2,10 @@ class DiscoverController < ApplicationController before_action :authenticate_user! def index + unless APP_CONFIG.dig(:features, :discover, :enabled) || current_user.mod? + return redirect_to root_path + end + top_x = 10 # only display the top X items @popular_answers = Answer.where("created_at > ?", Time.now.ago(1.week)).order(:smile_count).reverse_order.limit(top_x) diff --git a/app/views/layouts/_header.html.haml b/app/views/layouts/_header.html.haml index 0c07ee32..fc88d814 100644 --- a/app/views/layouts/_header.html.haml +++ b/app/views/layouts/_header.html.haml @@ -22,7 +22,7 @@ %ul.nav.navbar-nav = nav_entry t('views.navigation.timeline'), root_path = nav_entry t('views.navigation.inbox'), "/inbox", badge: inbox_count - - if APP_CONFIG.dig(:features, :discover, :enabled) + - if APP_CONFIG.dig(:features, :discover, :enabled) || current_user.mod? = nav_entry t('views.navigation.discover'), discover_path %ul.nav.navbar-nav.navbar-right - unless @user.nil? diff --git a/config/routes.rb b/config/routes.rb index e266e01c..8176f058 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -104,7 +104,7 @@ Rails.application.routes.draw do match '/unsubscribe', to: 'subscription#unsubscribe', via: :post, as: :unsubscribe_answer end - match '/discover', to: 'discover#index', via: :get, as: :discover if APP_CONFIG.dig(:features, :discover, :enabled) + match '/discover', to: 'discover#index', via: :get, as: :discover match '/public', to: 'public#index', via: :get, as: :public_timeline if APP_CONFIG.dig(:features, :public, :enabled) match '/group/:group_name', to: 'group#index', via: :get, as: :group_timeline