]> cat aescling's git repositories - mastodon.git/commitdiff
Fix suspended account's fields being set as empty dict instead of list (#10178)
authorThibG <thib@sitedethib.com>
Tue, 5 Mar 2019 14:19:54 +0000 (15:19 +0100)
committerEugen Rochko <eugen@zeonfederated.com>
Tue, 5 Mar 2019 14:19:54 +0000 (15:19 +0100)
Fixes #10177

app/models/account.rb
app/services/suspend_account_service.rb

index 87ce90178a777288ec7b1ebe2c8072918cf659bf..b1abd8f0d81b9d7110923a9867303c073001ba34 100644 (file)
@@ -241,6 +241,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|
index fc3bc03a532db3e05e0aca6610abaa29cf73c357..b2ae3a47c169b48adbe3d9d7ea5c9bd8fd15c4df 100644 (file)
@@ -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