status_edit_serializer.rb 613 B

12345678910111213141516171819202122
  1. # frozen_string_literal: true
  2. class REST::StatusEditSerializer < ActiveModel::Serializer
  3. include FormattingHelper
  4. has_one :account, serializer: REST::AccountSerializer
  5. attributes :content, :spoiler_text, :sensitive, :created_at
  6. has_many :ordered_media_attachments, key: :media_attachments, serializer: REST::MediaAttachmentSerializer
  7. has_many :emojis, serializer: REST::CustomEmojiSerializer
  8. attribute :poll, if: -> { object.poll_options.present? }
  9. def content
  10. status_content_format(object)
  11. end
  12. def poll
  13. { options: object.poll_options.map { |title| { title: title } } }
  14. end
  15. end