diff --git a/frontend/static/js/api/Profile.js b/frontend/static/js/api/Profile.js index a1e553d..0a1643f 100644 --- a/frontend/static/js/api/Profile.js +++ b/frontend/static/js/api/Profile.js @@ -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; diff --git a/profiles/serializers.py b/profiles/serializers.py index 5d0a8be..7ccaa95 100644 --- a/profiles/serializers.py +++ b/profiles/serializers.py @@ -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 diff --git a/profiles/viewsets/MyProfileViewSet.py b/profiles/viewsets/MyProfileViewSet.py index 97a7b6a..5ac6cdb 100644 --- a/profiles/viewsets/MyProfileViewSet.py +++ b/profiles/viewsets/MyProfileViewSet.py @@ -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)