diaspora/app/serializers/notification_serializer.rb
2017-09-17 19:29:15 +02:00

22 lines
515 B
Ruby

# frozen_string_literal: true
class NotificationSerializer < ActiveModel::Serializer
attributes :id,
:target_type,
:target_id,
:recipient_id,
:unread,
:created_at,
:updated_at,
:note_html
def note_html
context.render_to_string(partial: "notifications/notification", locals: {note: object, no_aspect_dropdown: true})
end
def initialize(*_)
super
self.polymorphic = true
self.root = false
end
end