mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
FIX: Data loss on update of single user_field.
https://meta.discourse.org/t/api-data-loss-caused-by-changed-behaviour-of-custom-user-field-update/74990
This commit is contained in:
parent
ae75c19f4b
commit
6a2bce1931
3 changed files with 26 additions and 1 deletions
|
@ -113,7 +113,10 @@ class UsersController < ApplicationController
|
|||
fields = UserField.all
|
||||
fields = fields.where(editable: true) unless current_user.staff?
|
||||
fields.each do |f|
|
||||
val = params[:user_fields][f.id.to_s]
|
||||
field_id = f.id.to_s
|
||||
next unless params[:user_fields].has_key?(field_id)
|
||||
|
||||
val = params[:user_fields][field_id]
|
||||
val = nil if val === "false"
|
||||
val = val[0...UserField.max_length] if val
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue