diff options
author | Claire <claire.github-309c@sitedethib.com> | 2023-01-26 20:16:31 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-26 20:16:31 +0100 |
commit | cfa92c4ec025609c24c24d73114033ecf150a438 (patch) | |
tree | af42722e4bdef8f4fcc4a43268e8ef033bf38a81 /app/serializers/rest/account_serializer.rb | |
parent | 20abef6590505d12aca81ed1c386804d75b8b552 (diff) | |
parent | fad6633156cae8ab2a7bad0c9802cf7918964ef4 (diff) |
Merge pull request #2095 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/serializers/rest/account_serializer.rb')
-rw-r--r-- | app/serializers/rest/account_serializer.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/app/serializers/rest/account_serializer.rb b/app/serializers/rest/account_serializer.rb index 6152d54f7..c4e281b80 100644 --- a/app/serializers/rest/account_serializer.rb +++ b/app/serializers/rest/account_serializer.rb @@ -26,6 +26,16 @@ class REST::AccountSerializer < ActiveModel::Serializer end end + class RoleSerializer < ActiveModel::Serializer + attributes :id, :name, :color + + def id + object.id.to_s + end + end + + has_many :roles, serializer: RoleSerializer, if: :local? + class FieldSerializer < ActiveModel::Serializer include FormattingHelper @@ -118,6 +128,14 @@ class REST::AccountSerializer < ActiveModel::Serializer object.silenced? end + def roles + if object.suspended? + [] + else + [object.user.role].compact.filter { |role| role.highlighted? } + end + end + def noindex object.user_prefers_noindex? end |