mirror of
https://github.com/discourse/discourse.git
synced 2024-12-24 01:36:27 +08:00
63b7a36fac
* FEATURE: Extend embeddable hosts with tags and author assignments
18 lines
365 B
Ruby
18 lines
365 B
Ruby
# frozen_string_literal: true
|
|
|
|
class EmbeddableHostSerializer < ApplicationSerializer
|
|
TO_SERIALIZE = %i[id host allowed_paths class_name category_id tags user]
|
|
|
|
attributes *TO_SERIALIZE
|
|
|
|
TO_SERIALIZE.each { |attr| define_method(attr) { object.public_send(attr) } }
|
|
|
|
def user
|
|
object.user&.username
|
|
end
|
|
|
|
def tags
|
|
object.tags.map(&:name)
|
|
end
|
|
end
|