Add duration to ActivityPub representation of media attachments (#38061)
This commit is contained in:
parent
0b0cdd7a77
commit
422d0e4e20
@ -257,6 +257,7 @@ class ActivityPub::NoteSerializer < ActivityPub::Serializer
|
||||
attribute :focal_point, if: :focal_point?
|
||||
attribute :width, if: :width?
|
||||
attribute :height, if: :height?
|
||||
attribute :duration, if: :duration?
|
||||
|
||||
has_one :icon, serializer: ActivityPub::ImageSerializer, if: :thumbnail?
|
||||
|
||||
@ -300,6 +301,10 @@ class ActivityPub::NoteSerializer < ActivityPub::Serializer
|
||||
object.file.meta&.dig('original', 'height').present?
|
||||
end
|
||||
|
||||
def duration?
|
||||
object.file.meta&.dig('original', 'duration').present?
|
||||
end
|
||||
|
||||
def width
|
||||
object.file.meta.dig('original', 'width')
|
||||
end
|
||||
@ -307,6 +312,10 @@ class ActivityPub::NoteSerializer < ActivityPub::Serializer
|
||||
def height
|
||||
object.file.meta.dig('original', 'height')
|
||||
end
|
||||
|
||||
def duration
|
||||
object.file.meta.dig('original', 'duration').seconds.iso8601
|
||||
end
|
||||
end
|
||||
|
||||
class MentionSerializer < ActivityPub::Serializer
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user