mirror of
https://github.com/mastodon/mastodon.git
synced 2024-08-20 21:08:15 -07:00
WIP
This commit is contained in:
parent
48fafc7389
commit
08235a8da7
4 changed files with 11 additions and 6 deletions
|
@ -10,7 +10,7 @@ class InitialStateSerializer < ActiveModel::Serializer
|
|||
attribute :critical_updates_pending, if: -> { object&.role&.can?(:view_devops) && SoftwareUpdate.check_enabled? }
|
||||
|
||||
has_one :push_subscription, serializer: REST::WebPushSubscriptionSerializer
|
||||
has_one :role, serializer: REST::RoleSerializer
|
||||
has_one :role, serializer: REST::CredentialRoleSerializer
|
||||
|
||||
def meta
|
||||
store = default_meta_store
|
||||
|
|
|
@ -11,7 +11,7 @@ class REST::Admin::AccountSerializer < ActiveModel::Serializer
|
|||
|
||||
has_many :ips, serializer: REST::Admin::IpSerializer
|
||||
has_one :account, serializer: REST::AccountSerializer
|
||||
has_one :role, serializer: REST::RoleSerializer
|
||||
has_one :role, serializer: REST::CredentialRoleSerializer
|
||||
|
||||
def id
|
||||
object.id.to_s
|
||||
|
|
9
app/serializers/rest/credential_role_serializer.rb
Normal file
9
app/serializers/rest/credential_role_serializer.rb
Normal file
|
@ -0,0 +1,9 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class REST::CredentialRoleSerializer < REST::RoleSerializer
|
||||
attributes :permissions
|
||||
|
||||
def permissions
|
||||
object.computed_permissions.to_s
|
||||
end
|
||||
end
|
|
@ -6,8 +6,4 @@ class REST::RoleSerializer < ActiveModel::Serializer
|
|||
def id
|
||||
object.id.to_s
|
||||
end
|
||||
|
||||
def permissions
|
||||
object.computed_permissions.to_s
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue