discourse/app/serializers/admin_web_hook_serializer.rb
Vinoth Kannan d33d031742
FEATURE: Filter topic and post web hook events by tags (#6726)
* FEATURE: Filter topic and post web hook events by tags

* Add a spec test with unmatched tags
2018-12-05 14:44:06 +05:30

20 lines
700 B
Ruby

class AdminWebHookSerializer < ApplicationSerializer
attributes :id,
:payload_url,
:content_type,
:last_delivery_status,
:secret,
:wildcard_web_hook,
:verify_certificate,
:active,
:web_hook_event_types
has_many :categories, serializer: BasicCategorySerializer, embed: :ids, include: false
has_many :tags, key: :tag_names, serializer: TagSerializer, embed: :ids, embed_key: :name, include: false
has_many :groups, serializer: BasicGroupSerializer, embed: :ids, include: false
def web_hook_event_types
ActiveModel::ArraySerializer.new(object.web_hook_event_types).as_json
end
end