mirror of
https://github.com/lunaisnotaboy/mastodon.git
synced 2024-11-09 00:15:05 +00:00
cefa526c6d
* Refactor formatter * Move custom emoji pre-rendering logic to view helpers * Move more methods out of Formatter * Fix code style issues * Remove Formatter * Add inline poll options to RSS feeds * Remove unused helper method * Fix code style issues * Various fixes and improvements * Fix test
23 lines
613 B
Ruby
23 lines
613 B
Ruby
# 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
|