Prevent unauthenticated access to tag timelines if timeline_preview is disabled

This commit is contained in:
Effy Elden 2022-12-21 13:58:32 +11:00 committed by GitHub
parent dac312a11a
commit 063fff4041
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,6 +1,7 @@
# frozen_string_literal: true
class Api::V1::Timelines::TagController < Api::BaseController
before_action :require_user!, only: [:show], if: :require_auth?
before_action :load_tag
after_action :insert_pagination_headers, unless: -> { @statuses.empty? }
@ -11,6 +12,10 @@ class Api::V1::Timelines::TagController < Api::BaseController
private
def require_auth?
!Setting.timeline_preview
end
def load_tag
@tag = Tag.find_normalized(params[:id])
end