Move default embed size knowledge into OEmbedSerializer (#31990)
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
@@ -7,7 +7,7 @@ class Api::OEmbedController < Api::BaseController
|
||||
before_action :require_public_status!
|
||||
|
||||
def show
|
||||
render json: @status, serializer: OEmbedSerializer, width: maxwidth_or_default, height: maxheight_or_default
|
||||
render json: @status, serializer: OEmbedSerializer, width: params[:maxwidth], height: params[:maxheight]
|
||||
end
|
||||
|
||||
private
|
||||
@@ -23,12 +23,4 @@ class Api::OEmbedController < Api::BaseController
|
||||
def status_finder
|
||||
StatusFinder.new(params[:url])
|
||||
end
|
||||
|
||||
def maxwidth_or_default
|
||||
(params[:maxwidth].presence || 400).to_i
|
||||
end
|
||||
|
||||
def maxheight_or_default
|
||||
params[:maxheight].present? ? params[:maxheight].to_i : nil
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user