From 4167cf47a3d9a2c1f52ccf58531ef15a1c739a0e Mon Sep 17 00:00:00 2001
From: Jean-Baptiste <bleme@pm.me>
Date: Mon, 28 Jan 2019 16:20:19 +0100
Subject: [PATCH] bugfix: fix chat by putting jabberID at the root of the
 member resource

---
 djangoldp_profile/models.py | 4 ++++
 djangoldp_profile/urls.py   | 6 ++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/djangoldp_profile/models.py b/djangoldp_profile/models.py
index b7fe595..7cba20f 100644
--- a/djangoldp_profile/models.py
+++ b/djangoldp_profile/models.py
@@ -4,6 +4,7 @@ from django.db.models.signals import post_save
 from django.dispatch import receiver
 from django.core.urlresolvers import reverse_lazy
 
+
 class Profile(models.Model):
     user = models.OneToOneField(User, on_delete=models.CASCADE)
     available = models.NullBooleanField(blank=True)
@@ -13,6 +14,9 @@ class Profile(models.Model):
     phone = models.CharField(max_length=255, blank=True, null=True)
     website = models.URLField(blank=True)
 
+    def jabberID(self):
+        return self.user.chatProfile.jabberID
+
     class Meta:
         auto_author = 'user'
         permissions = (
diff --git a/djangoldp_profile/urls.py b/djangoldp_profile/urls.py
index c143d96..2774193 100644
--- a/djangoldp_profile/urls.py
+++ b/djangoldp_profile/urls.py
@@ -1,10 +1,12 @@
 """djangoldp profile URL Configuration"""
-from django.conf.urls import url, include
+from django.conf.urls import url
 
 from djangoldp.permissions import AnonymousReadOnly
 from djangoldp.views import LDPViewSet
 from .models import Profile
 
 urlpatterns = [
-    url(r'^members/', LDPViewSet.urls(model=Profile, permission_classes=[AnonymousReadOnly])),
+    url(r'^members/', LDPViewSet.urls(model=Profile,
+                                      fields=['jabberID', 'user', 'available', 'bio', 'city', 'country', 'phone',
+                                              'website'], permission_classes=[AnonymousReadOnly])),
 ]
-- 
GitLab