Add config options to disable comments and the forum.

Add options to disable comments, the forum, and autocomplete. This is
for personal boorus and potentially for safe mode. Note that disabling
the forum may cause difficulties with creating and approving BURs.

Disabling comments and the forum merely hides them from most areas,
rather than completely removing them.
This commit is contained in:
evazion
2022-05-18 14:40:53 -05:00
parent 2fe38c1c07
commit 1e78b97eb8
14 changed files with 102 additions and 51 deletions

View File

@@ -4,6 +4,10 @@ class CommentsController < ApplicationController
respond_to :html, :xml, :json, :atom
respond_to :js, only: [:new, :update, :destroy, :undelete]
before_action if: -> { request.format.html? && !Danbooru.config.comments_enabled?.to_s.truthy? } do
redirect_to root_path
end
rate_limit :create, rate: 1.0/1.minute, burst: 50
def index