diff --git a/assets/javascripts/discourse/components/wizard-custom-action.js.es6 b/assets/javascripts/discourse/components/wizard-custom-action.js.es6 index 3264541b..2514ddce 100644 --- a/assets/javascripts/discourse/components/wizard-custom-action.js.es6 +++ b/assets/javascripts/discourse/components/wizard-custom-action.js.es6 @@ -12,6 +12,7 @@ const ACTION_TYPES = [ const PROFILE_FIELDS = [ 'name', + 'user_avatar', 'date_of_birth', 'title', 'locale', diff --git a/assets/javascripts/wizard/initializers/custom.js.es6 b/assets/javascripts/wizard/initializers/custom.js.es6 index a52f7559..b7a89bd7 100644 --- a/assets/javascripts/wizard/initializers/custom.js.es6 +++ b/assets/javascripts/wizard/initializers/custom.js.es6 @@ -256,6 +256,8 @@ export default { valid = val; } else if (type === 'category') { valid = val && val.toString().length > 0; + } else if (type === 'upload') { + valid = val && val.id > 0; } else if (StandardFieldValidation.indexOf(type) > -1) { valid = val && val.length > 0; } diff --git a/lib/builder.rb b/lib/builder.rb index 9fb66e2c..299cab23 100644 --- a/lib/builder.rb +++ b/lib/builder.rb @@ -476,13 +476,20 @@ class CustomWizard::Builder custom_fields[user_field || custom_field] = data[key] else updater_key = value - if ['profile_background', 'card_background'].include?(value) updater_key = "#{value}_upload_url" end - attributes[updater_key.to_sym] = data[key] if updater_key end + + if ['user_avatar'].include?(value) + this_upload_id = data[key][:id] + user.create_user_avatar unless user.user_avatar + user.user_avatar.custom_upload_id = this_upload_id + user.uploaded_avatar_id = this_upload_id + user.save! + user.user_avatar.save! + end end if custom_fields.present?