You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
613 B
22 lines
613 B
# frozen_string_literal: true |
|
|
|
class REST::StatusEditSerializer < ActiveModel::Serializer |
|
include FormattingHelper |
|
|
|
has_one :account, serializer: REST::AccountSerializer |
|
|
|
attributes :content, :spoiler_text, :sensitive, :created_at |
|
|
|
has_many :ordered_media_attachments, key: :media_attachments, serializer: REST::MediaAttachmentSerializer |
|
has_many :emojis, serializer: REST::CustomEmojiSerializer |
|
|
|
attribute :poll, if: -> { object.poll_options.present? } |
|
|
|
def content |
|
status_content_format(object) |
|
end |
|
|
|
def poll |
|
{ options: object.poll_options.map { |title| { title: title } } } |
|
end |
|
end
|
|
|