Patch #33117

Redirect to users_path instead of edit_user_path in order to avoid confusion

Added by Go MAEDA 4 months ago. Updated 17 days ago.

Status:NewStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Accounts / authentication
Target version:-

Description

Currently, a user is redirected to edit_user_path (/users/*/edit) after creating a user. However, I think it is better to be redirected to user_path (/users) for the following reasons:

  • Inconsistent. There are some exceptions but most forms in Admin page shows index page after an object is created
  • Confusing. Today I observed that an admin mistakenly rewrote the user that has just created. It is because they misunderstood that the form is /users/new, but it was actually /users/*/edit
  • I cannot find any use cases that showing edit_user_path is better than users_path
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 2fb297874..d3e853b43 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -122,7 +122,7 @@ class UsersController < ApplicationController
             attrs = {:generate_password => @user.generate_password }
             redirect_to new_user_path(:user => attrs)
           else
-            redirect_to edit_user_path(@user)
+            redirect_to users_path
           end
         }
         format.api  { render :action => 'show', :status => :created, :location => user_url(@user) }

33117.patch Magnifier (1.13 KB) Go MAEDA, 2020-05-04 02:52


Related issues

Related to Redmine - Feature #32783: Redirect to index page instead of edit page after creatin... Closed

History

#1 Updated by Go MAEDA 4 months ago

In early versions, the index page was displayed after creating a user, but the behavior was changed to display the edit form in r2869.

#2 Updated by Marius BALTEANU 4 months ago

  • Target version set to Candidate for next major release

#3 Updated by Go MAEDA 2 months ago

  • Related to Feature #32783: Redirect to index page instead of edit page after creating a new custom field added

#4 Updated by Go MAEDA 2 months ago

  • Target version changed from Candidate for next major release to 4.2.0

Setting the target version to 4.2.0.

#5 Updated by Go MAEDA about 1 month ago

Attaching a patch with an updated test.

#6 Updated by Go MAEDA about 1 month ago

  • Target version changed from 4.2.0 to Candidate for next major release

Removing from 4.2.0 because always redirecting to the first page of the list may not be appropriate.

The current patch always redirects to the first page of the users list even though a newly created user may be displayed on the other page. I felt the behavior is strange while testing.

#7 Updated by Go MAEDA 17 days ago

  • Target version deleted (Candidate for next major release)

Also available in: Atom PDF