kopia lustrzana https://dev.funkwhale.audio/funkwhale/funkwhale
Fix #869: broken user admin for users with non-digit or letters in their username
rodzic
cbe496e47b
commit
dc5db3a0c1
|
@ -44,12 +44,14 @@ class ManageUserSimpleSerializer(serializers.ModelSerializer):
|
|||
class ManageUserSerializer(serializers.ModelSerializer):
|
||||
permissions = PermissionsSerializer(source="*")
|
||||
upload_quota = serializers.IntegerField(allow_null=True)
|
||||
actor = serializers.SerializerMethodField()
|
||||
|
||||
class Meta:
|
||||
model = users_models.User
|
||||
fields = (
|
||||
"id",
|
||||
"username",
|
||||
"actor",
|
||||
"email",
|
||||
"name",
|
||||
"is_active",
|
||||
|
@ -82,6 +84,10 @@ class ManageUserSerializer(serializers.ModelSerializer):
|
|||
)
|
||||
return instance
|
||||
|
||||
def get_actor(self, obj):
|
||||
if obj.actor:
|
||||
return ManageBaseActorSerializer(obj.actor).data
|
||||
|
||||
|
||||
class ManageInvitationSerializer(serializers.ModelSerializer):
|
||||
users = ManageUserSimpleSerializer(many=True, required=False)
|
||||
|
|
|
@ -291,7 +291,7 @@ class ManageUserViewSet(
|
|||
mixins.UpdateModelMixin,
|
||||
viewsets.GenericViewSet,
|
||||
):
|
||||
queryset = users_models.User.objects.all().order_by("-id")
|
||||
queryset = users_models.User.objects.all().select_related("actor").order_by("-id")
|
||||
serializer_class = serializers.ManageUserSerializer
|
||||
filterset_class = filters.ManageUserFilterSet
|
||||
required_scope = "instance:users"
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Fixed broken user admin for users with non-digit or letters in their username (#869)
|
|
@ -45,7 +45,8 @@
|
|||
</template>
|
||||
<template slot="row-cells" slot-scope="scope">
|
||||
<td>
|
||||
<router-link :to="{name: 'manage.moderation.accounts.detail', params: {id: scope.obj.full_username }}">{{ scope.obj.username }}</router-link>
|
||||
<router-link v-if="scope.obj.actor" :to="{name: 'manage.moderation.accounts.detail', params: {id: scope.obj.actor.full_username }}">{{ scope.obj.username }}</router-link>
|
||||
<router-link v-else :to="{name: 'manage.moderation.accounts.detail', params: {id: scope.obj.full_username }}">{{ scope.obj.username }}</router-link>
|
||||
</td>
|
||||
<td>
|
||||
<span>{{ scope.obj.email }}</span>
|
||||
|
|
Ładowanie…
Reference in New Issue