FIX: If forcing a refresh, don't return a onebox preview
This commit is contained in:
parent
0b41046238
commit
2ff850d446
|
@ -6,10 +6,11 @@ class OneboxController < ApplicationController
|
|||
def show
|
||||
params.require(:user_id)
|
||||
|
||||
preview = Oneboxer.cached_preview(params[:url])
|
||||
preview.strip! if preview.present?
|
||||
|
||||
return render(plain: preview) if preview.present?
|
||||
unless params[:refresh] == 'true'
|
||||
preview = Oneboxer.cached_preview(params[:url])
|
||||
preview.strip! if preview.present?
|
||||
return render(plain: preview) if preview.present?
|
||||
end
|
||||
|
||||
# only 1 outgoing preview per user
|
||||
return render(nothing: true, status: 429) if Oneboxer.is_previewing?(params[:user_id])
|
||||
|
|
Loading…
Reference in New Issue