mirror of
https://github.com/glitch-soc/mastodon.git
synced 2024-11-27 10:30:15 -05:00
Move direct serializer usage out of admin view partial (#29028)
This commit is contained in:
parent
2d6ab44556
commit
69e61fff38
@ -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 New Issue
Block a user