This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
2017-07-06 19:02:06 -07:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class REST::NotificationSerializer < ActiveModel::Serializer
|
|
|
|
attributes :id, :type, :created_at
|
|
|
|
|
|
|
|
belongs_to :from_account, key: :account, serializer: REST::AccountSerializer
|
2017-07-07 07:19:28 -07:00
|
|
|
belongs_to :target_status, key: :status, if: :status_type?, serializer: REST::StatusSerializer
|
2017-07-06 19:02:06 -07:00
|
|
|
|
|
|
|
def status_type?
|
|
|
|
[:favourite, :reblog, :mention].include?(object.type)
|
|
|
|
end
|
|
|
|
end
|