Add optional filtered
attribute to notification entities in REST API (#31011)
This commit is contained in:
parent
17117109ad
commit
1dd8262071
2 changed files with 23 additions and 7 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue