comparison libervia/pages/chat/page_meta.py @ 1243:8aff742d0dd0

pages: updated `identityGet` call, following backend changes
author Goffi <goffi@goffi.org>
date Sun, 19 Apr 2020 22:56:59 +0200
parents 921e9f2a97af
children 6b7f9c3558cc
comparison
equal deleted inserted replaced
1242:8f39d98416c5 1243:8aff742d0dd0
2 2
3 from sat.core.i18n import _ 3 from sat.core.i18n import _
4 from twisted.internet import defer 4 from twisted.internet import defer
5 from sat.core.log import getLogger 5 from sat.core.log import getLogger
6 from sat.tools.common import data_objects 6 from sat.tools.common import data_objects
7 from sat.tools.common import data_format
7 from twisted.words.protocols.jabber import jid 8 from twisted.words.protocols.jabber import jid
8 from libervia.server.constants import Const as C 9 from libervia.server.constants import Const as C
9 from libervia.server import session_iface 10 from libervia.server import session_iface
10 11
11 12
83 profile, 84 profile,
84 ) 85 )
85 authors = {m[2] for m in history} 86 authors = {m[2] for m in history}
86 identities = {} 87 identities = {}
87 for author in authors: 88 for author in authors:
88 identities[author] = yield self.host.bridgeCall("identityGet", author, profile) 89 id_raw = yield self.host.bridgeCall(
90 "identityGet", author, [], True, profile)
91 identities[author] = data_format.deserialise(id_raw)
89 92
90 template_data["messages"] = data_objects.Messages(history) 93 template_data["messages"] = data_objects.Messages(history)
91 rdata['identities'] = template_data["identities"] = identities 94 rdata['identities'] = template_data["identities"] = identities
92 template_data["target_jid"] = target_jid 95 template_data["target_jid"] = target_jid
93 template_data["chat_type"] = chat_type 96 template_data["chat_type"] = chat_type
138 # the message is not linked with page's room/user 141 # the message is not linked with page's room/user
139 return 142 return
140 143
141 if from_jid_s not in identities: 144 if from_jid_s not in identities:
142 profile = self.getProfile(request) 145 profile = self.getProfile(request)
143 identities[from_jid_s] = yield self.host.bridgeCall( 146 id_raw = yield self.host.bridgeCall(
144 "identityGet", from_jid_s, profile 147 "identityGet", from_jid_s, [], True, profile
145 ) 148 )
149 identities[from_jid_s] = data_format.deserialise(id_raw)
146 template_data_update["identities"] = identities 150 template_data_update["identities"] = identities
147 self.renderAndUpdate( 151 self.renderAndUpdate(
148 request, "chat/message.html", "#messages", template_data_update 152 request, "chat/message.html", "#messages", template_data_update
149 ) 153 )
150 else: 154 else: