Mercurial > libervia-web
comparison libervia/pages/lists/view_item/page_meta.py @ 1461:8ac062d2ff8b
pages(lists/view_item): fix node used:
since we are now using XEP-0346, we must use the prefixed nodes for the `xmpp:` URI and
for the determining ownership.
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 30 Sep 2021 11:43:44 +0200 |
parents | a84383c659b4 |
children | e85ef5f3515e |
comparison
equal
deleted
inserted
replaced
1460:0ea54090e414 | 1461:8ac062d2ff8b |
---|---|
33 service, node, item_id = ( | 33 service, node, item_id = ( |
34 data.get("service", ""), | 34 data.get("service", ""), |
35 data.get("node", ""), | 35 data.get("node", ""), |
36 data["item_id"], | 36 data["item_id"], |
37 ) | 37 ) |
38 namespace = node or self.host.ns_map["tickets"] | |
39 node = await self.host.bridgeCall("psSchemaSubmittedNodeGet", namespace) | |
40 | |
38 profile = self.getProfile(request) | 41 profile = self.getProfile(request) |
39 | |
40 if profile is None: | 42 if profile is None: |
41 profile = C.SERVICE_PROFILE | 43 profile = C.SERVICE_PROFILE |
42 | 44 |
43 list_raw = await self.host.bridgeCall( | 45 list_raw = await self.host.bridgeCall( |
44 "listGet", | 46 "listGet", |
88 # the node owner | 90 # the node owner |
89 publisher = jid.JID(list_item.widgets["publisher"].value) | 91 publisher = jid.JID(list_item.widgets["publisher"].value) |
90 is_publisher = publisher.userhostJID() == session.jid.userhostJID() | 92 is_publisher = publisher.userhostJID() == session.jid.userhostJID() |
91 affiliation = None | 93 affiliation = None |
92 if not is_publisher: | 94 if not is_publisher: |
93 node = node or self.host.ns_map["tickets"] | |
94 affiliation = await self.host.getAffiliation(request, service, node) | 95 affiliation = await self.host.getAffiliation(request, service, node) |
95 if is_publisher or affiliation == "owner": | 96 if is_publisher or affiliation == "owner": |
96 self.exposeToScripts( | 97 self.exposeToScripts( |
97 request, | 98 request, |
98 pubsub_service = service.full(), | 99 pubsub_service = service.full(), |
107 item_id, | 108 item_id, |
108 ) | 109 ) |
109 | 110 |
110 # we add xmpp: URI | 111 # we add xmpp: URI |
111 uri_args = {'path': service.full()} | 112 uri_args = {'path': service.full()} |
112 uri_args['node'] = node or self.host.ns_map["tickets"] | 113 uri_args['node'] = node |
113 if item_id: | 114 if item_id: |
114 uri_args['item'] = item_id | 115 uri_args['item'] = item_id |
115 template_data['xmpp_uri'] = uri.buildXMPPUri('pubsub', **uri_args) | 116 template_data['xmpp_uri'] = uri.buildXMPPUri('pubsub', **uri_args) |
116 | 117 |
117 | 118 |