Add missing moderation_warning
notification support to grouped notifications API (#30576)
This commit is contained in:
parent
5652ca6135
commit
1ffc293b86
1 changed files with 5 additions and 0 deletions
|
@ -11,6 +11,7 @@ class REST::NotificationGroupSerializer < ActiveModel::Serializer
|
||||||
belongs_to :target_status, key: :status, if: :status_type?, serializer: REST::StatusSerializer
|
belongs_to :target_status, key: :status, if: :status_type?, serializer: REST::StatusSerializer
|
||||||
belongs_to :report, if: :report_type?, serializer: REST::ReportSerializer
|
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_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?
|
def status_type?
|
||||||
[:favourite, :reblog, :status, :mention, :poll, :update].include?(object.type)
|
[:favourite, :reblog, :status, :mention, :poll, :update].include?(object.type)
|
||||||
|
@ -24,6 +25,10 @@ class REST::NotificationGroupSerializer < ActiveModel::Serializer
|
||||||
object.type == :severed_relationships
|
object.type == :severed_relationships
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def moderation_warning_event?
|
||||||
|
object.type == :moderation_warning
|
||||||
|
end
|
||||||
|
|
||||||
def page_min_id
|
def page_min_id
|
||||||
range = instance_options[:group_metadata][object.group_key]
|
range = instance_options[:group_metadata][object.group_key]
|
||||||
range.present? ? range[:min_id].to_s : object.notification.id.to_s
|
range.present? ? range[:min_id].to_s : object.notification.id.to_s
|
||||||
|
|
Loading…
Reference in a new issue