Translate CW, poll options and media descriptions (#24175)
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
parent
44cd88adc4
commit
69057467cb
25 changed files with 603 additions and 100 deletions
|
@ -1,9 +1,38 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class REST::TranslationSerializer < ActiveModel::Serializer
|
||||
attributes :content, :detected_source_language, :provider
|
||||
attributes :detected_source_language, :language, :provider, :spoiler_text, :content
|
||||
|
||||
def content
|
||||
object.text
|
||||
class PollSerializer < ActiveModel::Serializer
|
||||
attribute :id
|
||||
has_many :options
|
||||
|
||||
def id
|
||||
object.status.preloadable_poll.id.to_s
|
||||
end
|
||||
|
||||
def options
|
||||
object.poll_options
|
||||
end
|
||||
|
||||
class OptionSerializer < ActiveModel::Serializer
|
||||
attributes :title
|
||||
end
|
||||
end
|
||||
|
||||
has_one :poll, serializer: PollSerializer
|
||||
|
||||
class MediaAttachmentSerializer < ActiveModel::Serializer
|
||||
attributes :id, :description
|
||||
|
||||
def id
|
||||
object.id.to_s
|
||||
end
|
||||
end
|
||||
|
||||
has_many :media_attachments, serializer: MediaAttachmentSerializer
|
||||
|
||||
def poll
|
||||
object if object.status.preloadable_poll
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue