From ae9e5ac6c8116001c13d4d49d3e3bdc64e98aa1b Mon Sep 17 00:00:00 2001
From: ThibG <thib@sitedethib.com>
Date: Tue, 5 Mar 2019 15:19:54 +0100
Subject: [PATCH] Fix suspended account's fields being set as empty dict
 instead of list (#10178)

Fixes #10177
---
 app/models/account.rb                   | 1 +
 app/services/suspend_account_service.rb | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/app/models/account.rb b/app/models/account.rb
index 11a3c21fe4..930fd1674e 100644
--- a/app/models/account.rb
+++ b/app/models/account.rb
@@ -240,6 +240,7 @@ class Account < ApplicationRecord
   def fields_attributes=(attributes)
     fields     = []
     old_fields = self[:fields] || []
+    old_fields = [] if old_fields.is_a?(Hash)
 
     if attributes.is_a?(Hash)
       attributes.each_value do |attr|
diff --git a/app/services/suspend_account_service.rb b/app/services/suspend_account_service.rb
index fc3bc03a53..b2ae3a47c1 100644
--- a/app/services/suspend_account_service.rb
+++ b/app/services/suspend_account_service.rb
@@ -84,7 +84,7 @@ class SuspendAccountService < BaseService
     @account.locked           = false
     @account.display_name     = ''
     @account.note             = ''
-    @account.fields           = {}
+    @account.fields           = []
     @account.statuses_count   = 0
     @account.followers_count  = 0
     @account.following_count  = 0
-- 
GitLab