From 1ffc293b86fa373beada17fbe789b0e729781e07 Mon Sep 17 00:00:00 2001 From: Claire Date: Thu, 6 Jun 2024 16:12:06 +0200 Subject: [PATCH] Add missing `moderation_warning` notification support to grouped notifications API (#30576) --- app/serializers/rest/notification_group_serializer.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/serializers/rest/notification_group_serializer.rb b/app/serializers/rest/notification_group_serializer.rb index 6c1d2465d..05b51b07a 100644 --- a/app/serializers/rest/notification_group_serializer.rb +++ b/app/serializers/rest/notification_group_serializer.rb @@ -11,6 +11,7 @@ class REST::NotificationGroupSerializer < ActiveModel::Serializer belongs_to :target_status, key: :status, if: :status_type?, serializer: REST::StatusSerializer 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 status_type? [:favourite, :reblog, :status, :mention, :poll, :update].include?(object.type) @@ -24,6 +25,10 @@ class REST::NotificationGroupSerializer < ActiveModel::Serializer object.type == :severed_relationships end + def moderation_warning_event? + object.type == :moderation_warning + end + def page_min_id range = instance_options[:group_metadata][object.group_key] range.present? ? range[:min_id].to_s : object.notification.id.to_s