2
0

Move default embed size knowledge into OEmbedSerializer (#31990)

Co-authored-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
Matt Jankowski
2024-09-20 08:39:48 -04:00
committed by GitHub
parent 8afa3bb2fa
commit bdf83c353f
3 changed files with 6 additions and 12 deletions

View File

@@ -8,6 +8,8 @@ class OEmbedSerializer < ActiveModel::Serializer
div1: 'font-weight: 500;',
}.freeze
DEFAULT_WIDTH = 400
include RoutingHelper
include ActionView::Helpers::TagHelper
@@ -57,10 +59,10 @@ class OEmbedSerializer < ActiveModel::Serializer
end
def width
instance_options[:width]
(instance_options[:width] || DEFAULT_WIDTH).to_i
end
def height
instance_options[:height]
instance_options[:height].presence&.to_i
end
end