Merge remote-tracking branch 'origin/master' into rails5

This commit is contained in:
Georg Gadinger 2020-04-19 14:32:47 +02:00
commit 6f6ac3cc7d
3 changed files with 6 additions and 2 deletions

View File

@ -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)

View File

@ -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?

View File

@ -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