enable 'Discover' page for mods
This commit is contained in:
parent
e52e44eff2
commit
9fa8ef1501
|
@ -2,6 +2,10 @@ class DiscoverController < ApplicationController
|
|||
before_filter :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)
|
||||
|
|
|
@ -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?
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue