mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-23 17:44:24 +00:00
44b2ee3485
* Add customizable user roles * Various fixes and improvements * Add migration for old settings and fix tootctl role management
26 lines
546 B
Ruby
26 lines
546 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_cohorts
|
|
|
|
after_action :verify_authorized
|
|
|
|
def create
|
|
authorize :dashboard, :index?
|
|
render json: @cohorts, each_serializer: REST::Admin::CohortSerializer
|
|
end
|
|
|
|
private
|
|
|
|
def set_cohorts
|
|
@cohorts = Admin::Metrics::Retention.new(
|
|
params[:start_at],
|
|
params[:end_at],
|
|
params[:frequency]
|
|
).cohorts
|
|
end
|
|
end
|