Commit 31478ea6 authored by Eliot Berriot's avatar Eliot Berriot
Browse files

Merge branch '869-username-chars' into 'master'

Resolve "Cannot edit users details"

See merge request funkwhale/funkwhale!808
parents cbe496e4 dc5db3a0
......@@ -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"
......
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>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment