kopia lustrzana https://dev.funkwhale.audio/funkwhale/funkwhale
See #890: Added is_local attribute on admin account API representations
rodzic
d7705593a9
commit
9488094ff9
|
@ -1,3 +1,4 @@
|
|||
from django.conf import settings
|
||||
from django.db import transaction
|
||||
|
||||
from rest_framework import serializers
|
||||
|
@ -183,6 +184,8 @@ class ManageDomainActionSerializer(common_serializers.ActionSerializer):
|
|||
|
||||
|
||||
class ManageBaseActorSerializer(serializers.ModelSerializer):
|
||||
is_local = serializers.SerializerMethodField()
|
||||
|
||||
class Meta:
|
||||
model = federation_models.Actor
|
||||
fields = [
|
||||
|
@ -201,9 +204,13 @@ class ManageBaseActorSerializer(serializers.ModelSerializer):
|
|||
"outbox_url",
|
||||
"shared_inbox_url",
|
||||
"manually_approves_followers",
|
||||
"is_local",
|
||||
]
|
||||
read_only_fields = ["creation_date", "instance_policy"]
|
||||
|
||||
def get_is_local(self, o):
|
||||
return o.domain_id == settings.FEDERATION_HOSTNAME
|
||||
|
||||
|
||||
class ManageActorSerializer(ManageBaseActorSerializer):
|
||||
uploads_count = serializers.SerializerMethodField()
|
||||
|
|
|
@ -87,6 +87,7 @@ def test_manage_actor_serializer(factories, now, to_api_date):
|
|||
"full_username": actor.full_username,
|
||||
"user": None,
|
||||
"instance_policy": None,
|
||||
"is_local": False,
|
||||
}
|
||||
s = serializers.ManageActorSerializer(actor)
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue