Sha256: bf51b43cce34446204f9899efe346db5b5a83b127265e3d3276569d90198bcb0

Contents?: true

Size: 828 Bytes

Versions: 1

Compression:

Stored size: 828 Bytes

Contents

module Federails
  module Server
    class NodeinfoController < Federails::ServerController
      def index
        skip_authorization

        render formats: [:nodeinfo]
      end

      def show # rubocop:todo Metrics/AbcSize
        skip_authorization

        @total = @active_halfyear = @active_month = 0
        @has_user_counts = false
        Federails::Configuration.actor_types.each_value do |config|
          next unless (method = config[:user_count_method]&.to_sym)

          @has_user_counts = true
          model = config[:class]
          @total += model.send(method, nil)
          @active_month += model.send(method, ((30.days.ago)...Time.current))
          @active_halfyear += model.send(method, ((180.days.ago)...Time.current))
        end
        render formats: [:nodeinfo]
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
federails-0.4.0 app/controllers/federails/server/nodeinfo_controller.rb