mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-27 05:51:37 +01:00
a2871cd747
* Add administrative webhooks * Fix error when webhook is deleted before delivery worker runs
26 lines
472 B
Ruby
26 lines
472 B
Ruby
# frozen_string_literal: true
|
|
|
|
class REST::Admin::WebhookEventSerializer < ActiveModel::Serializer
|
|
def self.serializer_for(model, options)
|
|
case model.class.name
|
|
when 'Account'
|
|
REST::Admin::AccountSerializer
|
|
when 'Report'
|
|
REST::Admin::ReportSerializer
|
|
else
|
|
super
|
|
end
|
|
end
|
|
|
|
attributes :event, :created_at
|
|
|
|
has_one :virtual_object, key: :object
|
|
|
|
def virtual_object
|
|
object.object
|
|
end
|
|
|
|
def event
|
|
object.type
|
|
end
|
|
end
|