make `i:am`/`we:are` signatures available to the client api

staging
multiple creatures 2019-07-28 19:06:02 -05:00
parent 28b2a700f0
commit 9e841ece20
1 changed files with 8 additions and 1 deletions

View File

@ -6,7 +6,7 @@ class REST::AccountSerializer < ActiveModel::Serializer
attributes :id, :username, :acct, :display_name, :locked, :bot, :created_at,
:note, :url, :avatar, :avatar_static, :header, :header_static,
:followers_count, :following_count, :statuses_count, :replies,
:adult_content, :gently, :kobold, :role, :froze
:adult_content, :gently, :kobold, :role, :froze, :signature
has_one :moved_to_account, key: :moved, serializer: REST::AccountSerializer, if: :moved_and_not_nested?
has_many :emojis, serializer: REST::CustomEmojiSerializer
@ -66,4 +66,11 @@ class REST::AccountSerializer < ActiveModel::Serializer
def froze
object.local? ? (object&.user.nil? ? true : object.user.disabled?) : object.froze?
end
def signature
return unless object.local? && object&.user.present?
name = object.user.vars['_they:are']
return if name.blank?
object.user.vars["_they:are:#{name}"]
end
end