about summary refs log tree commit diff
path: root/app/serializers/rest
diff options
context:
space:
mode:
authorJenkins <jenkins@jenkins.ninjawedding.org>2017-12-15 01:17:12 +0000
committerJenkins <jenkins@jenkins.ninjawedding.org>2017-12-15 01:17:12 +0000
commit37254c4f5d1f4397551c94e59a4d474f444b1d9a (patch)
tree8975374e2cbfced954f1bfc6de6de2652ceccf30 /app/serializers/rest
parente5a9831a56e7fdc0a767f0d8a059bebeabeed22f (diff)
parent098c7d27fe3a2d35d555f415717b9e019504dd91 (diff)
Merge remote-tracking branch 'tootsuite/master' into glitchsoc/master
Diffstat (limited to 'app/serializers/rest')
-rw-r--r--app/serializers/rest/account_serializer.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/app/serializers/rest/account_serializer.rb b/app/serializers/rest/account_serializer.rb
index bab944c5a..19b746520 100644
--- a/app/serializers/rest/account_serializer.rb
+++ b/app/serializers/rest/account_serializer.rb
@@ -7,9 +7,7 @@ class REST::AccountSerializer < ActiveModel::Serializer
              :note, :url, :avatar, :avatar_static, :header, :header_static,
              :followers_count, :following_count, :statuses_count
 
-  has_one :moved_to_account, key: :moved, serializer: REST::AccountSerializer, if: :moved?
-
-  delegate :moved?, to: :object
+  has_one :moved_to_account, key: :moved, serializer: REST::AccountSerializer, if: :moved_and_not_nested?
 
   def id
     object.id.to_s
@@ -38,4 +36,8 @@ class REST::AccountSerializer < ActiveModel::Serializer
   def header_static
     full_asset_url(object.header_static_url)
   end
+
+  def moved_and_not_nested?
+    object.moved? && object.moved_to_account.moved_to_account_id.nil?
+  end
 end