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):
|
class ManageUserSerializer(serializers.ModelSerializer):
|
||||||
permissions = PermissionsSerializer(source="*")
|
permissions = PermissionsSerializer(source="*")
|
||||||
upload_quota = serializers.IntegerField(allow_null=True)
|
upload_quota = serializers.IntegerField(allow_null=True)
|
||||||
|
actor = serializers.SerializerMethodField()
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = users_models.User
|
model = users_models.User
|
||||||
fields = (
|
fields = (
|
||||||
"id",
|
"id",
|
||||||
"username",
|
"username",
|
||||||
|
"actor",
|
||||||
"email",
|
"email",
|
||||||
"name",
|
"name",
|
||||||
"is_active",
|
"is_active",
|
||||||
|
@ -82,6 +84,10 @@ class ManageUserSerializer(serializers.ModelSerializer):
|
||||||
)
|
)
|
||||||
return instance
|
return instance
|
||||||
|
|
||||||
|
def get_actor(self, obj):
|
||||||
|
if obj.actor:
|
||||||
|
return ManageBaseActorSerializer(obj.actor).data
|
||||||
|
|
||||||
|
|
||||||
class ManageInvitationSerializer(serializers.ModelSerializer):
|
class ManageInvitationSerializer(serializers.ModelSerializer):
|
||||||
users = ManageUserSimpleSerializer(many=True, required=False)
|
users = ManageUserSimpleSerializer(many=True, required=False)
|
||||||
|
|
|
@ -291,7 +291,7 @@ class ManageUserViewSet(
|
||||||
mixins.UpdateModelMixin,
|
mixins.UpdateModelMixin,
|
||||||
viewsets.GenericViewSet,
|
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
|
serializer_class = serializers.ManageUserSerializer
|
||||||
filterset_class = filters.ManageUserFilterSet
|
filterset_class = filters.ManageUserFilterSet
|
||||||
required_scope = "instance:users"
|
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>
|
||||||
<template slot="row-cells" slot-scope="scope">
|
<template slot="row-cells" slot-scope="scope">
|
||||||
<td>
|
<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>
|
||||||
<td>
|
<td>
|
||||||
<span>{{ scope.obj.email }}</span>
|
<span>{{ scope.obj.email }}</span>
|
||||||
|
|
Ładowanie…
Reference in New Issue