fix(profiles): online null when not authenticated

This commit is contained in:
AdrienLSH 2024-04-28 09:50:38 +02:00
parent 9fea10fc91
commit 4351c335cb
3 changed files with 8 additions and 2 deletions

View File

@ -30,6 +30,11 @@ export class Profile extends AExchangeable
*/
this.avatar = avatar;
/**
* @type {Boolean}
**/
this.online = null;
/**
* @type {Boolean}
*/
@ -58,6 +63,7 @@ export class Profile extends AExchangeable
this.id = response_data.id;
this.username = response_data.username;
this.avatar = response_data.avatar;
this.online = response_data.online
if (!this.client.me || this.client.me.id === this.id)
return;

View File

@ -25,7 +25,7 @@ class ProfileSerializer(serializers.ModelSerializer):
user = request.user
if user is None:
return False
return None
if user.pk == obj.pk:
return True

View File

@ -35,4 +35,4 @@ class MyProfileViewSet(viewsets.ModelViewSet):
return Response(ProfileSerializer(profile).data)
def retrieve(self, pk=None):
return Response(self.serializer_class(self.get_object()).data)
return Response(self.serializer_class(self.get_object(), context={'request': self.request}).data)