3114: Follow return_to param, if given, when redirecting users#show to projects#show.
authorTom Clegg <tom@curoverse.com>
Mon, 18 Aug 2014 22:19:29 +0000 (18:19 -0400)
committerTom Clegg <tom@curoverse.com>
Mon, 18 Aug 2014 22:26:45 +0000 (18:26 -0400)
Don't redirect non-html requests.

apps/workbench/app/controllers/users_controller.rb

index 189f295f8fe097c2a2a17e8a5f41342ed254eef0..27f13b7205b4d633c004f483d7ca3da659ebd53f 100644 (file)
@@ -7,7 +7,11 @@ class UsersController < ApplicationController
 
   def show
     if params[:uuid] == current_user.uuid
-      redirect_to project_path(params[:uuid])
+      respond_to do |f|
+        f.html do
+          redirect_to(params[:return_to] || project_path(params[:uuid]))
+        end
+      end
     else
       super
     end