# HG changeset patch # User Goffi # Date 1515166205 -3600 # Node ID 4cc4d49e1d0fbd1eca28fca1da1924e4591e032e # Parent ded41172dcb56f94210f6d4365eb49fd65fd9f43 pages (chat): moved rendering preparation in prepare_render, and redirect to page_select if no jid is specified. diff -r ded41172dcb5 -r 4cc4d49e1d0f src/pages/chat/page_meta.py --- a/src/pages/chat/page_meta.py Fri Jan 05 16:30:03 2018 +0100 +++ b/src/pages/chat/page_meta.py Fri Jan 05 16:30:05 2018 +0100 @@ -16,18 +16,14 @@ dynamic = True -@defer.inlineCallbacks def parse_url(self, request): - session = self.host.getSessionData(request, session_iface.ISATSession) rdata = self.getRData(request) - template_data = request.template_data - profile = session.profile try: target_jid_s = self.nextPath(request) except IndexError: - log.warning(_(u"missing chat jid")) - self.pageError(request, C.HTTP_BAD_REQUEST) + # not chat jid, we redirect to jid selection page + self.pageRedirect(u"chat_select", request) try: target_jid = jid.JID(target_jid_s) @@ -41,6 +37,15 @@ else: rdata['target'] = target_jid + +@defer.inlineCallbacks +def prepare_render(self, request): + # FIXME: bug on room filtering (currently display messages from all rooms) + session = self.host.getSessionData(request, session_iface.ISATSession) + template_data = request.template_data + rdata = self.getRData(request) + target_jid = rdata['target'] + profile = session.profile profile_jid = session.jid if profile_jid is None: jid_s = yield self.host.bridgeCall(u'getParamA', "JabberID", "Connection", profile_key=profile)