From a7f9464cc2aa01da61ce718c4be4c6f40e7459bd Mon Sep 17 00:00:00 2001 From: albert Date: Fri, 14 Oct 2011 14:35:18 -0400 Subject: [PATCH] fixes #122: Broken terms of service redirects (404) when browsing to any page except / --- app/assets/javascripts/cookie.js | 4 ++-- app/views/static/terms_of_service.html.erb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/cookie.js b/app/assets/javascripts/cookie.js index 39c3a6b31..8b6852d66 100644 --- a/app/assets/javascripts/cookie.js +++ b/app/assets/javascripts/cookie.js @@ -50,10 +50,10 @@ loc = loc.replace(/^https?:\/\/[^\/]+/, "") } - if (loc.match(/^\/(comment|pool|note|post)/) && this.get("tos") != "1") { + if (!loc.match(/\/static\/terms_of_service/) && this.get("tos") != "1") { // Setting location.pathname in Safari doesn't work, so manually extract the domain. var domain = location.href.match(/^(https?:\/\/[^\/]+)/)[0]; - location.href = domain + "/terms_of_service?url=" + encodeURIComponent(location.href); + location.href = domain + "/static/terms_of_service"; return; } diff --git a/app/views/static/terms_of_service.html.erb b/app/views/static/terms_of_service.html.erb index b03cab227..63844a391 100644 --- a/app/views/static/terms_of_service.html.erb +++ b/app/views/static/terms_of_service.html.erb @@ -10,7 +10,7 @@
  • Small and large images. All images now get a small and large version.
  • -

    <%= link_to("Continue", params[:url] || "/", :id => "tos-agree-link") %>

    +

    <%= link_to("Continue", request.env["HTTP_REFERER"] || "/", :id => "tos-agree-link") %>