logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

notification_serializer.rb (429B)


  1. # frozen_string_literal: true
  2. class REST::NotificationSerializer < ActiveModel::Serializer
  3. attributes :id, :type, :created_at
  4. belongs_to :from_account, key: :account, serializer: REST::AccountSerializer
  5. belongs_to :target_status, key: :status, if: :status_type?, serializer: REST::StatusSerializer
  6. def id
  7. object.id.to_s
  8. end
  9. def status_type?
  10. [:favourite, :reblog, :mention].include?(object.type)
  11. end
  12. end