mirror of
https://github.com/mastodon/mastodon.git
synced 2026-07-29 08:27:52 -05:00
* Fix GHSA-7jvv-fhmg-wpfw * Fix GHSA-hx34-2pfw-2qfj * Fix GHSA-vwhj-3g83-v276 * Bump version to v4.6.4
26 lines
570 B
Ruby
26 lines
570 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Api::V1::Admin::RetentionController < Api::BaseController
|
|
include Authorization
|
|
|
|
before_action -> { authorize_if_got_token! :'admin:read' }
|
|
before_action :set_retention
|
|
|
|
after_action :verify_authorized
|
|
|
|
def create
|
|
authorize :dashboard, :index?
|
|
render json: @retention.cohorts, each_serializer: REST::Admin::CohortSerializer
|
|
end
|
|
|
|
private
|
|
|
|
def set_retention
|
|
@retention = Admin::Metrics::Retention.new(
|
|
params.require(:start_at),
|
|
params.require(:end_at),
|
|
params[:frequency]
|
|
)
|
|
end
|
|
end
|