Redirect after processing user changes
authorTom Hughes <tom@compton.nu>
Fri, 7 May 2010 13:08:25 +0000 (14:08 +0100)
committerTom Hughes <tom@compton.nu>
Fri, 7 May 2010 13:27:52 +0000 (14:27 +0100)
After we have processed the requested user changes, redirect back
to the list so that the resulting page is reloadable without getting
resubmission warnings from the browser.

app/controllers/user_controller.rb

index 5b9f5a0c754b1feb3f6d16dc7ef1adae53e0622e..222840a0610a60ed1117594c65e746eca7742ef5 100644 (file)
@@ -339,16 +339,18 @@ class UserController < ApplicationController
 
       User.update_all("status = 'confirmed'", :id => ids) if params[:confirm]
       User.update_all("status = 'deleted'", :id => ids) if params[:hide]
-    end
-
-    conditions = Hash.new
-    conditions[:status] = params[:status] if params[:status]
-    conditions[:creation_ip] = params[:ip] if params[:ip]
 
-    @user_pages, @users = paginate(:users,
-                                   :conditions => conditions,
-                                   :order => :id,
-                                   :per_page => 50)
+      redirect_to url_for(:status => params[:status], :ip => params[:ip], :page => params[:page])
+    else
+      conditions = Hash.new
+      conditions[:status] = params[:status] if params[:status]
+      conditions[:creation_ip] = params[:ip] if params[:ip]
+
+      @user_pages, @users = paginate(:users,
+                                     :conditions => conditions,
+                                     :order => :id,
+                                     :per_page => 50)
+    end
   end
 
 private