2023-11-14 09:53:31 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class Api::V1::Timelines::BaseController < Api::BaseController
|
|
|
|
after_action :insert_pagination_headers, unless: -> { @statuses.empty? }
|
|
|
|
|
2024-07-04 10:26:49 -04:00
|
|
|
before_action :require_user!, if: :require_auth?
|
|
|
|
|
2023-11-14 09:53:31 -05:00
|
|
|
private
|
|
|
|
|
2024-07-04 10:26:49 -04:00
|
|
|
def require_auth?
|
|
|
|
!Setting.timeline_preview
|
|
|
|
end
|
|
|
|
|
2024-03-13 04:51:44 -04:00
|
|
|
def pagination_collection
|
|
|
|
@statuses
|
2023-11-14 09:53:31 -05: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
|