about summary refs log tree commit diff
path: root/app/serializers/rest
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2022-05-10 09:44:35 +0200
committerGitHub <noreply@github.com>2022-05-10 09:44:35 +0200
commitb4d373a3df2752d9f8bdc0d7f02350528f3789b2 (patch)
treeb093d14cf34baa0e729be2376d168a9a3527f320 /app/serializers/rest
parent898fe2fa8e886d62de2bd9b15eb758054216d33d (diff)
Add `limited` attribute to accounts in REST API and a warning in web UI (#18344)
Diffstat (limited to 'app/serializers/rest')
-rw-r--r--app/serializers/rest/account_serializer.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/app/serializers/rest/account_serializer.rb b/app/serializers/rest/account_serializer.rb
index 4cf7b253f..c52a89d87 100644
--- a/app/serializers/rest/account_serializer.rb
+++ b/app/serializers/rest/account_serializer.rb
@@ -13,6 +13,7 @@ class REST::AccountSerializer < ActiveModel::Serializer
   has_many :emojis, serializer: REST::CustomEmojiSerializer
 
   attribute :suspended, if: :suspended?
+  attribute :silenced, key: :limited, if: :silenced?
 
   class FieldSerializer < ActiveModel::Serializer
     include FormattingHelper
@@ -98,7 +99,11 @@ class REST::AccountSerializer < ActiveModel::Serializer
     object.suspended?
   end
 
-  delegate :suspended?, to: :object
+  def silenced
+    object.silenced?
+  end
+
+  delegate :suspended?, :silenced?, to: :object
 
   def moved_and_not_nested?
     object.moved? && object.moved_to_account.moved_to_account_id.nil?