mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-25 17:51:36 +01:00
Move direct serializer usage out of admin view partial (#29028)
This commit is contained in:
parent
2d6ab44556
commit
69e61fff38
2 changed files with 12 additions and 1 deletions
|
@ -15,9 +15,20 @@ module ReactComponentHelper
|
|||
div_tag_with_data(data)
|
||||
end
|
||||
|
||||
def serialized_media_attachments(media_attachments)
|
||||
media_attachments.map { |attachment| serialized_attachment(attachment) }
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def div_tag_with_data(data)
|
||||
content_tag(:div, nil, data: data)
|
||||
end
|
||||
|
||||
def serialized_attachment(attachment)
|
||||
ActiveModelSerializers::SerializableResource.new(
|
||||
attachment,
|
||||
serializer: REST::MediaAttachmentSerializer
|
||||
).as_json
|
||||
end
|
||||
end
|
||||
|
|
|
@ -12,6 +12,6 @@
|
|||
= react_component :media_gallery,
|
||||
height: 343,
|
||||
lang: status.language,
|
||||
media: status.ordered_media_attachments.map { |a| ActiveModelSerializers::SerializableResource.new(a, serializer: REST::MediaAttachmentSerializer).as_json },
|
||||
media: serialized_media_attachments(status.ordered_media_attachments),
|
||||
sensitive: status.sensitive?,
|
||||
visible: false
|
||||
|
|
Loading…
Reference in a new issue