Project

General

Profile

Actions

Bug #6782

closed

user's location and organisation are wiped out when making irrelevant changes to the user account

Added by Neil Miao almost 10 years ago. Updated almost 10 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
Web Interface
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

How to reproduce:

1. user bob own a host that belongs to Location A and Organisation B
2. edit bob, verify that the location A and Org B are pre-selected and greys out
3. edit something, say 'surname' and save
4. bob disappeared from location A and organisation B, and he shows up in the mismatch report

it seems the when the user's location and org multi-selectbox is disabled, the pre-selected values didn't made their way into some hidden field.

feasible patch:

diff --git a/app/views/users/_form.html.erb b/app/views/users/_form.html.erb
index 6c28beb..e2fc195 100644
--- a/app/views/users/_form.html.erb
+++ b/app/views/users/_form.html.erb
@@ -56,7 +56,8 @@
         <%= location_selects(f, @user.used_or_selected_location_ids,
                              { :disabled => @editing_self ? Location.pluck(:id) : @user.used_location_ids,
                                :label    => :none } ,
-                             { :onchange => 'taxonomy_added(this, "location")' } ) %>
+                             { :onchange => 'taxonomy_added(this, "location")',
+                               'data-useds' => @user.used_location_ids.to_json } ) %>
       </div>
     <% end %>

@@ -65,7 +66,8 @@
         <%= organization_selects(f, @user.used_or_selected_organization_ids,
                                  { :disabled => @editing_self ? Organization.pluck(:id) : @user.used_organization_ids,
                                    :label => :none },
-                                 { :onchange => 'taxonomy_added(this, "organization")' } ) %>
+                                 { :onchange => 'taxonomy_added(this, "organization")',
+                                   'data-useds' => @user.used_organization_ids.to_json } ) %>
Actions #1

Updated by Dominic Cleal almost 10 years ago

  • Category set to Web Interface

Please submit patches via GitHub pull requests, we don't take them from issue reports. Thanks.

Actions #2

Updated by Neil Miao almost 10 years ago

I said "feasible patch" cos I am not sure if there is any better way to do it. that's all

Actions #3

Updated by Neil Miao almost 10 years ago

besides, it seems the code in develop branch eliminate the bug already. just giving u guys a heads up.

Actions #4

Updated by Dominic Cleal almost 10 years ago

  • Status changed from New to Resolved

Good to hear, closing as resolved in 1.6.0. Thanks!

Actions

Also available in: Atom PDF