diff options
Diffstat (limited to 'app/serializers/rest/account_serializer.rb')
-rw-r--r-- | app/serializers/rest/account_serializer.rb | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/app/serializers/rest/account_serializer.rb b/app/serializers/rest/account_serializer.rb index 9a3ca75dc..6152d54f7 100644 --- a/app/serializers/rest/account_serializer.rb +++ b/app/serializers/rest/account_serializer.rb @@ -16,6 +16,16 @@ class REST::AccountSerializer < ActiveModel::Serializer attribute :silenced, key: :limited, if: :silenced? attribute :noindex, if: :local? + class AccountDecorator < SimpleDelegator + def self.model_name + Account.model_name + end + + def moved? + false + end + end + class FieldSerializer < ActiveModel::Serializer include FormattingHelper @@ -89,7 +99,7 @@ class REST::AccountSerializer < ActiveModel::Serializer end def moved_to_account - object.suspended? ? nil : object.moved_to_account + object.suspended? ? nil : AccountDecorator.new(object.moved_to_account) end def emojis @@ -115,6 +125,6 @@ class REST::AccountSerializer < ActiveModel::Serializer delegate :suspended?, :silenced?, :local?, to: :object def moved_and_not_nested? - object.moved? && object.moved_to_account.moved_to_account_id.nil? + object.moved? end end |