0
0
Fork 0

Add optional filtered attribute to notification entities in REST API (#31011)

This commit is contained in:
Claire 2024-07-15 11:29:57 +02:00 committed by GitHub
parent 17117109ad
commit 1dd8262071
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 23 additions and 7 deletions

View file

@ -3,6 +3,8 @@
class REST::NotificationSerializer < ActiveModel::Serializer
attributes :id, :type, :created_at, :group_key
attribute :filtered, if: :filtered?
belongs_to :from_account, key: :account, serializer: REST::AccountSerializer
belongs_to :target_status, key: :status, if: :status_type?, serializer: REST::StatusSerializer
belongs_to :report, if: :report_type?, serializer: REST::ReportSerializer
@ -32,4 +34,6 @@ class REST::NotificationSerializer < ActiveModel::Serializer
def moderation_warning_event?
object.type == :moderation_warning
end
delegate :filtered?, to: :object
end