Merge remote-tracking branch 'parent/main' into upstream-20240806

This commit is contained in:
KMY 2024-08-06 08:16:16 +09:00
commit 8e5fe5ccb9
166 changed files with 2268 additions and 1390 deletions

View file

@ -8,12 +8,20 @@ class REST::NotificationGroupSerializer < ActiveModel::Serializer
attribute :page_max_id, if: :paginated?
attribute :latest_page_notification_at, if: :paginated?
has_many :sample_accounts, serializer: REST::AccountSerializer
belongs_to :target_status, key: :status, if: :status_type?, serializer: REST::StatusSerializer
attribute :sample_account_ids
attribute :status_id, if: :status_type?
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
def sample_account_ids
object.sample_accounts.pluck(:id).map(&:to_s)
end
def status_id
object.target_status&.id&.to_s
end
def status_type?
[:favourite, :emoji_reaction, :reblog, :status, :mention, :status_reference, :poll, :update].include?(object.type)
end