changeset 1243:8aff742d0dd0

pages: updated `identityGet` call, following backend changes
author Goffi <goffi@goffi.org>
date Sun, 19 Apr 2020 22:56:59 +0200
parents 8f39d98416c5
children 2ed4e399e1d4
files libervia/pages/blog/page_meta.py libervia/pages/blog/view/page_meta.py libervia/pages/chat/page_meta.py libervia/pages/forums/topics/page_meta.py
diffstat 4 files changed, 20 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/libervia/pages/blog/page_meta.py	Sun Apr 19 22:56:15 2020 +0200
+++ b/libervia/pages/blog/page_meta.py	Sun Apr 19 22:56:59 2020 +0200
@@ -5,6 +5,7 @@
 from twisted.words.protocols.jabber import jid
 from twisted.internet import defer
 from libervia.server import session_iface
+from sat.tools.common import data_format
 from sat.core.log import getLogger
 
 log = getLogger(__name__)
@@ -45,15 +46,17 @@
             if entity_jid_s not in identities:
                 d_list.append(self.host.bridgeCall("identityGet",
                                                    entity_jid_s,
+                                                   [],
+                                                   True,
                                                    profile))
         identities_data = yield defer.DeferredList(d_list)
-        for idx, (success, identity) in enumerate(identities_data):
+        for idx, (success, identity_raw) in enumerate(identities_data):
             entity_jid_s = entities[idx]
             if not success:
                 log.warning(_("Can't retrieve identity of {entity}")
                     .format(entity=entity_jid_s))
             else:
-                identities[entity_jid_s] = identity
+                identities[entity_jid_s] = data_format.deserialise(identity_raw)
 
 
 def on_data_post(self, request):
--- a/libervia/pages/blog/view/page_meta.py	Sun Apr 19 22:56:15 2020 +0200
+++ b/libervia/pages/blog/view/page_meta.py	Sun Apr 19 22:56:59 2020 +0200
@@ -118,7 +118,9 @@
                 log.warning(_("no author found for item {item_id}").format(item_id=blog_item.id))
             else:
                 if author not in identities:
-                    identities[author] = yield self.host.bridgeCall('identityGet', author, profile)
+                    id_raw = yield self.host.bridgeCall(
+                        'identityGet', author, [], True, profile)
+                    identities[author] = data_format.deserialise(id_raw)
         for comment_data in blog_item.comments:
             service = comment_data['service']
             node = comment_data['node']
--- a/libervia/pages/chat/page_meta.py	Sun Apr 19 22:56:15 2020 +0200
+++ b/libervia/pages/chat/page_meta.py	Sun Apr 19 22:56:59 2020 +0200
@@ -4,6 +4,7 @@
 from twisted.internet import defer
 from sat.core.log import getLogger
 from sat.tools.common import data_objects
+from sat.tools.common import data_format
 from twisted.words.protocols.jabber import jid
 from libervia.server.constants import Const as C
 from libervia.server import session_iface
@@ -85,7 +86,9 @@
     authors = {m[2] for m in history}
     identities = {}
     for author in authors:
-        identities[author] = yield self.host.bridgeCall("identityGet", author, profile)
+        id_raw = yield self.host.bridgeCall(
+            "identityGet", author, [], True, profile)
+        identities[author] = data_format.deserialise(id_raw)
 
     template_data["messages"] = data_objects.Messages(history)
     rdata['identities'] = template_data["identities"] = identities
@@ -140,9 +143,10 @@
 
         if from_jid_s not in identities:
             profile = self.getProfile(request)
-            identities[from_jid_s] = yield self.host.bridgeCall(
-                "identityGet", from_jid_s, profile
+            id_raw = yield self.host.bridgeCall(
+                "identityGet", from_jid_s, [], True, profile
             )
+            identities[from_jid_s] = data_format.deserialise(id_raw)
             template_data_update["identities"] = identities
         self.renderAndUpdate(
             request, "chat/message.html", "#messages", template_data_update
--- a/libervia/pages/forums/topics/page_meta.py	Sun Apr 19 22:56:15 2020 +0200
+++ b/libervia/pages/forums/topics/page_meta.py	Sun Apr 19 22:56:59 2020 +0200
@@ -6,6 +6,7 @@
 from sat.core.i18n import _
 from sat.core.log import getLogger
 from sat.tools.common import uri as xmpp_uri
+from sat.tools.common import data_format
 
 log = getLogger(__name__)
 
@@ -36,9 +37,11 @@
             parsed_uri["path"], parsed_uri["node"]
         )
         if author not in identities:
-            identities[topic["author"]] = yield self.host.bridgeCall(
-                "identityGet", author, profile
+            id_raw = yield self.host.bridgeCall(
+                "identityGet", author, [], True, profile
             )
+            identities[topic["author"]] = data_format.deserialise(id_raw)
+
     template_data["topics"] = topics