diff sat/plugins/plugin_tickets_import.py @ 3452:bb0225aaf4e6

plugin XEP-0346: "Form Discovery and Publishing" implementation: this implementation replaces the former non standard node schema, and works in a similar way (the schema is put in a separated node instead of a special field, thus it will now work with most/all PubSub services, and not only SàT PubSub). The implementation has been done in a way that nothing should be changed in frontends (bridge methods names and arguments stay the same). The nodes are modified, but if values are taken from backend, it's automatically adapted.
author Goffi <goffi@goffi.org>
date Fri, 11 Dec 2020 17:57:00 +0100
parents 559a625a236b
children be6d91572633
line wrap: on
line diff
--- a/sat/plugins/plugin_tickets_import.py	Fri Dec 11 17:50:53 2020 +0100
+++ b/sat/plugins/plugin_tickets_import.py	Fri Dec 11 17:57:00 2020 +0100
@@ -32,7 +32,7 @@
     C.PI_NAME: "tickets import",
     C.PI_IMPORT_NAME: "TICKETS_IMPORT",
     C.PI_TYPE: C.PLUG_TYPE_IMPORT,
-    C.PI_DEPENDENCIES: ["IMPORT", "XEP-0060", "XEP-0277", "PUBSUB_SCHEMA"],
+    C.PI_DEPENDENCIES: ["IMPORT", "XEP-0060", "XEP-0277", "XEP-0346"],
     C.PI_MAIN: "TicketsImportPlugin",
     C.PI_HANDLER: "no",
     C.PI_DESCRIPTION: _(
@@ -45,7 +45,7 @@
 FIELDS_LIST = ("labels", "cc_emails")  # fields which must have a list as value
 FIELDS_DATE = ("created", "updated")
 
-NS_TICKETS = "org.salut-a-toi.tickets:0"
+NS_TICKETS = "fdp/submitted/org.salut-a-toi.tickets:0"
 
 
 class TicketsImportPlugin(object):
@@ -59,7 +59,7 @@
         self._importers = {}
         self._p = host.plugins["XEP-0060"]
         self._m = host.plugins["XEP-0277"]
-        self._s = host.plugins["PUBSUB_SCHEMA"]
+        self._s = host.plugins["XEP-0346"]
         host.plugins["IMPORT"].initialize(self, "tickets")
 
     @defer.inlineCallbacks
@@ -161,8 +161,10 @@
                 id=id_, title=ticket_data.get("title", "")
             )
         )
-        return self._s.sendDataFormItem(
-            client, service, node, ticket_data, session["schema"], id_
+        return defer.ensureDeferred(
+            self._s.sendDataFormItem(
+                client, service, node, ticket_data, session["schema"], id_
+            )
         )
 
     def itemFilters(self, client, ticket_data, session, options):