FIX: Can't remove user profile uploads.

FIX: Can’t remove user profile uploads.

Follow up to 24347ace10ad54f7f3bbc687bc7bc37734f558e4.

diff --git a/app/services/user_updater.rb b/app/services/user_updater.rb
index 1caf4ea..7803856 100644
--- a/app/services/user_updater.rb
+++ b/app/services/user_updater.rb
@@ -55,12 +55,16 @@ class UserUpdater
       user_profile.bio_raw = attributes.fetch(:bio_raw) { user_profile.bio_raw }
     end
 
-    if upload = Upload.get_from_url(attributes[:profile_background_upload_url])
-      user_profile.upload_profile_background(upload)
+    if attributes[:profile_background_upload_url] == ""
+      user_profile.profile_background_upload_id = nil
+    elsif upload = Upload.get_from_url(attributes[:profile_background_upload_url])
+      user_profile.profile_background_upload_id = upload.id
     end
 
-    if upload = Upload.get_from_url(attributes[:card_background_upload_url])
-      user_profile.upload_card_background(upload)
+    if attributes[:card_background_upload_url] == ""
+      user_profile.card_background_upload_id = nil
+    elsif upload = Upload.get_from_url(attributes[:card_background_upload_url])
+      user_profile.card_background_upload_id = upload.id
     end
 
     old_user_name = user.name.present? ? user.name : ""
diff --git a/spec/services/user_updater_spec.rb b/spec/services/user_updater_spec.rb
index e646b04..7826d2a 100644
--- a/spec/services/user_updater_spec.rb
+++ b/spec/services/user_updater_spec.rb
@@ -184,6 +184,17 @@ describe UserUpdater do
       expect(user.date_of_birth).to eq(date_of_birth.to_date)
       expect(user.card_background_upload).to eq(upload1)
       expect(user.profile_background_upload).to eq(upload2)
+
+      success = updater.update(
+        profile_background_upload_url: "",
+        card_background_upload_url: ""
+      )
+
+      user.reload
+
+      expect(success).to eq(true)
+      expect(user.card_background_upload).to eq(nil)
+      expect(user.profile_background_upload).to eq(nil)
     end
 
     it "disables email_digests when enabling mailing_list_mode" do

GitHub sha: d252dad4