0
0
Fork 0

Add year in review feature to web UI (#32709)

This commit is contained in:
Eugen Rochko 2024-11-05 15:40:07 +01:00 committed by GitHub
parent 20a147170e
commit d6349c0e9a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
38 changed files with 1103 additions and 21 deletions

View file

@ -0,0 +1,9 @@
# frozen_string_literal: true
class REST::AnnualReportEventSerializer < ActiveModel::Serializer
attributes :year
def year
object.year.to_s
end
end

View file

@ -13,6 +13,7 @@ class REST::NotificationGroupSerializer < ActiveModel::Serializer
belongs_to :report, if: :report_type?, serializer: REST::ReportSerializer
belongs_to :account_relationship_severance_event, key: :event, if: :relationship_severance_event?, serializer: REST::AccountRelationshipSeveranceEventSerializer
belongs_to :account_warning, key: :moderation_warning, if: :moderation_warning_event?, serializer: REST::AccountWarningSerializer
belongs_to :generated_annual_report, key: :annual_report, if: :annual_report_event?, serializer: REST::AnnualReportEventSerializer
def sample_account_ids
object.sample_accounts.pluck(:id).map(&:to_s)
@ -38,6 +39,10 @@ class REST::NotificationGroupSerializer < ActiveModel::Serializer
object.type == :moderation_warning
end
def annual_report_event?
object.type == :annual_report
end
def page_min_id
object.pagination_data[:min_id].to_s
end