mirror of
https://github.com/discourse/discourse.git
synced 2024-11-28 01:06:19 +08:00
30 lines
543 B
Ruby
30 lines
543 B
Ruby
class NotificationSerializer < ApplicationSerializer
|
|
|
|
attributes :id,
|
|
:notification_type,
|
|
:read,
|
|
:created_at,
|
|
:post_number,
|
|
:topic_id,
|
|
:slug,
|
|
:data,
|
|
:is_warning
|
|
|
|
def slug
|
|
Slug.for(object.topic.title) if object.topic.present?
|
|
end
|
|
|
|
def is_warning
|
|
object.topic.present? && object.topic.subtype == TopicSubtype.moderator_warning
|
|
end
|
|
|
|
def include_is_warning?
|
|
is_warning
|
|
end
|
|
|
|
def data
|
|
object.data_hash
|
|
end
|
|
|
|
end
|