plugin tickets import: create comments nodes with open access/publishing

This commit is contained in:
Goffi 2017-10-27 08:35:22 +02:00
commit 414665c76a

View file

@ -97,9 +97,17 @@ class TicketsImportPlugin(object):
def importSubItems(self, client, item_import_data, ticket_data, session, options):
# TODO: force "open" permission (except if private, check below)
# TODO: handle "private" metadata, to have non public access for node
# TODO: node access/publish model should be customisable
comments = ticket_data.get('comments', [])
service, node = self._m.getCommentsService(client), self._m.getCommentsNode(session['root_node'] + u'_' + ticket_data['id'])
yield self._p.createIfNewNode(client, service, node)
node_options = {self._p.OPT_ACCESS_MODEL: self._p.ACCESS_OPEN,
self._p.OPT_PERSIST_ITEMS: 1,
self._p.OPT_MAX_ITEMS: -1,
self._p.OPT_DELIVER_PAYLOADS: 1,
self._p.OPT_SEND_ITEM_SUBSCRIBE: 1,
self._p.OPT_PUBLISH_MODEL: self._p.ACCESS_OPEN,
}
yield self._p.createIfNewNode(client, service, node, options=node_options)
ticket_data['comments_uri'] = uri.buildXMPPUri(u'pubsub', subtype='microblog', path=service.full(), node=node)
for comment in comments:
if 'updated' not in comment and 'published' in comment: