about summary refs log tree commit diff
path: root/app/serializers
diff options
context:
space:
mode:
Diffstat (limited to 'app/serializers')
-rw-r--r--app/serializers/rest/account_serializer.rb8
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