1
0
mirror of https://github.com/mastodon/mastodon synced 2024-11-24 15:16:19 +09:00
mastodon/app/presenters/annual_reports_presenter.rb
2024-01-24 09:38:10 +00:00

24 lines
561 B
Ruby

# frozen_string_literal: true
class AnnualReportsPresenter
alias read_attribute_for_serialization send
attr_reader :annual_reports
def initialize(annual_reports)
@annual_reports = annual_reports
end
def accounts
@accounts ||= Account.where(id: @annual_reports.flat_map(&:account_ids)).includes(:account_stat, :moved_to_account, user: :role)
end
def statuses
@statuses ||= Status.where(id: @annual_reports.flat_map(&:status_ids)).with_includes
end
def self.model_name
@model_name ||= ActiveModel::Name.new(self)
end
end