mirror of
https://github.com/mastodon/mastodon.git
synced 2025-11-29 02:50:46 +00:00
26 lines
659 B
Ruby
26 lines
659 B
Ruby
# frozen_string_literal: true
|
|
|
|
class REST::Admin::ModerationNoteSerializer < ActiveModel::Serializer
|
|
include RoutingHelper
|
|
|
|
attributes :id, :content, :created_at, :updated_at, :target
|
|
belongs_to :account, serializer: REST::Admin::AccountMinimalSerializer
|
|
|
|
def id
|
|
object.id.to_s
|
|
end
|
|
|
|
def content
|
|
object.content.strip
|
|
end
|
|
|
|
def target
|
|
case object
|
|
when ReportNote
|
|
{ type: 'Report', id: object.report_id.to_s, url: api_v1_admin_report_url(object.report.id) }
|
|
when AccountModerationNote
|
|
{ type: 'Account', id: object.target_account_id.to_s, url: api_v1_admin_account_url(object.target_account.id) }
|
|
end
|
|
end
|
|
end
|