mirror of
https://github.com/lunaisnotaboy/mastodon.git
synced 2024-08-19 14:56:58 +00:00
* Add bell button Fix #4890 * Remove duplicate type from post-deployment migration * Fix legacy class type mappings * Improve query performance with better index * Fix validation * Remove redundant index from notifications
17 lines
445 B
Ruby
17 lines
445 B
Ruby
# frozen_string_literal: true
|
|
|
|
class REST::NotificationSerializer < ActiveModel::Serializer
|
|
attributes :id, :type, :created_at
|
|
|
|
belongs_to :from_account, key: :account, serializer: REST::AccountSerializer
|
|
belongs_to :target_status, key: :status, if: :status_type?, serializer: REST::StatusSerializer
|
|
|
|
def id
|
|
object.id.to_s
|
|
end
|
|
|
|
def status_type?
|
|
[:favourite, :reblog, :status, :mention, :poll].include?(object.type)
|
|
end
|
|
end
|