Actions
Bug #6782
closeduser's location and organisation are wiped out when making irrelevant changes to the user account
Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
Web Interface
Target version:
-
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