2023-11-15 01:53:31 +11:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class Api::V1::Timelines::BaseController < Api::BaseController
|
|
|
|
after_action :insert_pagination_headers, unless: -> { @statuses.empty? }
|
|
|
|
|
2024-07-05 00:26:49 +10:00
|
|
|
before_action :require_user!, if: :require_auth?
|
|
|
|
|
2023-11-15 01:53:31 +11:00
|
|
|
private
|
|
|
|
|
2024-07-05 00:26:49 +10:00
|
|
|
def require_auth?
|
|
|
|
!Setting.timeline_preview
|
|
|
|
end
|
|
|
|
|
2024-03-13 19:51:44 +11:00
|
|
|
def pagination_collection
|
|
|
|
@statuses
|
2023-11-15 01:53:31 +11:00
|
|
|
end
|
|
|
|
|
|
|
|
def next_path_params
|
|
|
|
permitted_params.merge(max_id: pagination_max_id)
|
|
|
|
end
|
|
|
|
|
|
|
|
def prev_path_params
|
|
|
|
permitted_params.merge(min_id: pagination_since_id)
|
|
|
|
end
|
|
|
|
|
|
|
|
def permitted_params
|
|
|
|
params
|
|
|
|
.slice(*self.class::PERMITTED_PARAMS)
|
|
|
|
.permit(*self.class::PERMITTED_PARAMS)
|
|
|
|
end
|
|
|
|
end
|