FIX: show an error page on click tracking error

This commit is contained in:
Régis Hanol
2018-03-17 00:33:11 +01:00
parent 864bdbd9b6
commit 89f5c90ce0
5 changed files with 32 additions and 22 deletions

View File

@ -1,4 +1,5 @@
class ClicksController < ApplicationController
layout "no_ember"
skip_before_action :check_xhr, :preload_json
@ -19,10 +20,12 @@ class ClicksController < ApplicationController
# Sometimes we want to record a link without a 302.
# Since XHR has to load the redirected URL we want it to not return a 302 in those cases.
if params[:redirect] == "false" || @redirect_url.blank?
if params[:redirect] == "false"
render body: nil
else
elsif @redirect_url.present?
redirect_to(@redirect_url)
else
render
end
end