mirror of
https://github.com/opf/openproject.git
synced 2026-06-13 19:20:00 +00:00
move check for api doc enabledness to before action
Otherwise there is double render happending and it is cleaner to use a before action than to return when rendirng 404
This commit is contained in:
@@ -29,14 +29,19 @@
|
||||
#++
|
||||
|
||||
class APIDocsController < ApplicationController
|
||||
before_action :require_login
|
||||
before_action :require_login,
|
||||
:check_if_api_docs_enabled
|
||||
no_authorization_required! :index
|
||||
|
||||
helper API::APIDocsHelper
|
||||
|
||||
def index
|
||||
render_404 unless Setting.apiv3_docs_enabled?
|
||||
|
||||
render locals: { turbo_opt_out: true }
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def check_if_api_docs_enabled
|
||||
render_404 unless Setting.apiv3_docs_enabled?
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user