Merge remote-tracking branch 'origin/master' into rails5
This commit is contained in:
commit
6f6ac3cc7d
|
@ -2,6 +2,10 @@ class DiscoverController < ApplicationController
|
||||||
before_action :authenticate_user!
|
before_action :authenticate_user!
|
||||||
|
|
||||||
def index
|
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
|
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)
|
@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
|
%ul.nav.navbar-nav
|
||||||
= nav_entry t('views.navigation.timeline'), root_path
|
= nav_entry t('views.navigation.timeline'), root_path
|
||||||
= nav_entry t('views.navigation.inbox'), "/inbox", badge: inbox_count
|
= 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
|
= nav_entry t('views.navigation.discover'), discover_path
|
||||||
%ul.nav.navbar-nav.navbar-right
|
%ul.nav.navbar-nav.navbar-right
|
||||||
- unless @user.nil?
|
- unless @user.nil?
|
||||||
|
|
|
@ -104,7 +104,7 @@ Rails.application.routes.draw do
|
||||||
match '/unsubscribe', to: 'subscription#unsubscribe', via: :post, as: :unsubscribe_answer
|
match '/unsubscribe', to: 'subscription#unsubscribe', via: :post, as: :unsubscribe_answer
|
||||||
end
|
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 '/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
|
match '/group/:group_name', to: 'group#index', via: :get, as: :group_timeline
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue