diff options
author | Claire <claire.github-309c@sitedethib.com> | 2021-05-17 11:33:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-17 11:33:17 +0200 |
commit | 567745c1e66593ef46a86dc0bcfe824cefb04f14 (patch) | |
tree | fd533bcafe02475fbc19681cc764d75fe6f16e12 /app/serializers/activitypub/note_serializer.rb | |
parent | 678e07c54485c6cc61b2ac18aa5ceaa290a6fcbd (diff) | |
parent | 69737b703ab1d9b9e49315f12c3aca8cf6df70ac (diff) |
Merge pull request #1539 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/serializers/activitypub/note_serializer.rb')
-rw-r--r-- | app/serializers/activitypub/note_serializer.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/app/serializers/activitypub/note_serializer.rb b/app/serializers/activitypub/note_serializer.rb index c4f8f5c3f..e08c537b0 100644 --- a/app/serializers/activitypub/note_serializer.rb +++ b/app/serializers/activitypub/note_serializer.rb @@ -181,6 +181,8 @@ class ActivityPub::NoteSerializer < ActivityPub::Serializer attributes :type, :media_type, :url, :name, :blurhash attribute :focal_point, if: :focal_point? + attribute :width, if: :width? + attribute :height, if: :height? has_one :icon, serializer: ActivityPub::ImageSerializer, if: :thumbnail? @@ -215,6 +217,22 @@ class ActivityPub::NoteSerializer < ActivityPub::Serializer def thumbnail? object.thumbnail.present? end + + def width? + object.file.meta&.dig('original', 'width').present? + end + + def height? + object.file.meta&.dig('original', 'height').present? + end + + def width + object.file.meta.dig('original', 'width') + end + + def height + object.file.meta.dig('original', 'height') + end end class MentionSerializer < ActivityPub::Serializer |