From 83b49a90823d258c3175f0141cecf4b0b3b0d8b5 Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Wed, 11 Sep 2019 19:08:00 +1000 Subject: [PATCH] Profile updates bugfixes --- lib/builder.rb | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/builder.rb b/lib/builder.rb index 39180039..018fd7ff 100644 --- a/lib/builder.rb +++ b/lib/builder.rb @@ -455,8 +455,8 @@ class CustomWizard::Builder action['profile_updates'].each do |pu| value = pu['value'] custom_field = nil - - if pu['value_custom'] + + if pu['value_custom'].present? custom_parts = pu['value_custom'].split('.') if custom_parts.length == 2 && custom_parts[0] == 'custom_field' custom_field = custom_parts[1] @@ -471,14 +471,20 @@ class CustomWizard::Builder if user_field || custom_field custom_fields[user_field || custom_field] = data[key] else - attributes[value.to_sym] = data[key] + 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 end if custom_fields.present? attributes[:custom_fields] = custom_fields end - + if attributes.present? user_updater = UserUpdater.new(user, user) user_updater.update(attributes)