diff options
author | multiple creatures <dev@multiple-creature.party> | 2019-05-19 10:54:21 -0500 |
---|---|---|
committer | multiple creatures <dev@multiple-creature.party> | 2019-05-21 03:16:51 -0500 |
commit | ee83fe92f170fd5bfe2d037e3c27bc895a67073b (patch) | |
tree | 4bc57481942e9aca819b4def634ab1a624a1560f /app/serializers | |
parent | 1244c303492106f6e45f5ed0b00763ea2f16358e (diff) |
expose account roles to the api
Diffstat (limited to 'app/serializers')
-rw-r--r-- | app/serializers/rest/account_serializer.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/app/serializers/rest/account_serializer.rb b/app/serializers/rest/account_serializer.rb index 019bac26a..7716aafde 100644 --- a/app/serializers/rest/account_serializer.rb +++ b/app/serializers/rest/account_serializer.rb @@ -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, - :adults_only, :gentlies_kobolds, :is_a_kobold + :adults_only, :gentlies_kobolds, :is_a_kobold, :role has_one :moved_to_account, key: :moved, serializer: REST::AccountSerializer, if: :moved_and_not_nested? has_many :emojis, serializer: REST::CustomEmojiSerializer @@ -64,4 +64,10 @@ class REST::AccountSerializer < ActiveModel::Serializer def is_a_kobold object.user_is_a_kobold? || false end + + def role + return 'admin' if object.user_admin? + return 'moderator' if object.user_moderator? + 'user' + end end |