merge_requests: use XHTML for body
This commit is contained in:
parent
b385a19b75
commit
9cfbbce2d1
2 changed files with 19 additions and 30 deletions
|
|
@ -34,7 +34,7 @@ PLUGIN_INFO = {
|
|||
C.PI_IMPORT_NAME: "MERGE_REQUESTS",
|
||||
C.PI_TYPE: "EXP",
|
||||
C.PI_PROTOCOLS: [],
|
||||
C.PI_DEPENDENCIES: ["XEP-0060", "PUBSUB_SCHEMA", "TICKETS"],
|
||||
C.PI_DEPENDENCIES: ["XEP-0060", "PUBSUB_SCHEMA", "TICKETS", "TEXT_SYNTAXES"],
|
||||
C.PI_MAIN: "MergeRequests",
|
||||
C.PI_HANDLER: "no",
|
||||
C.PI_DESCRIPTION: _("""Merge requests management plugin""")
|
||||
|
|
@ -67,9 +67,9 @@ class MergeRequests(object):
|
|||
log.info(_(u"Merge requests plugin initialization"))
|
||||
self.host = host
|
||||
host.registerNamespace('merge_requests', NS_MERGE_REQUESTS)
|
||||
self._p = self.host.plugins["XEP-0060"]
|
||||
self._s = self.host.plugins["PUBSUB_SCHEMA"]
|
||||
self._t = self.host.plugins["TICKETS"]
|
||||
self._p = self.host.plugins[u"XEP-0060"]
|
||||
self._s = self.host.plugins[u"PUBSUB_SCHEMA"]
|
||||
self._t = self.host.plugins[u"TICKETS"]
|
||||
self._handlers = {}
|
||||
self._handlers_list = [] # handlers sorted by priority
|
||||
self._type_handlers = {} # data type => handler map
|
||||
|
|
@ -259,7 +259,14 @@ class MergeRequests(object):
|
|||
if not values.get(u'title'):
|
||||
values[u'title'] = msg_lines[0]
|
||||
if not values.get(u'body'):
|
||||
values[u'body'] = u'\n'.join(msg_lines[1:])
|
||||
ts = self.host.plugins['TEXT_SYNTAXES']
|
||||
xhtml = yield ts.convert(
|
||||
u'\n'.join(msg_lines[1:]),
|
||||
syntax_from = ts.SYNTAX_TEXT,
|
||||
syntax_to = ts.SYNTAX_XHTML,
|
||||
profile = client.profile)
|
||||
values[u'body'] = '<div xmlns="{ns}">{xhtml}</div>'.format(
|
||||
ns=C.NS_XHTML, xhtml=xhtml)
|
||||
|
||||
values[FIELD_DATA] = data
|
||||
|
||||
|
|
|
|||
|
|
@ -83,16 +83,8 @@ class Tickets(object):
|
|||
async=True,
|
||||
)
|
||||
|
||||
def _set(
|
||||
self,
|
||||
service,
|
||||
node,
|
||||
values,
|
||||
schema=None,
|
||||
item_id=None,
|
||||
extra=None,
|
||||
profile_key=C.PROF_KEY_NONE,
|
||||
):
|
||||
def _set(self, service, node, values, schema=None, item_id=None, extra=None,
|
||||
profile_key=C.PROF_KEY_NONE):
|
||||
client, service, node, schema, item_id, extra = self._s.prepareBridgeSet(
|
||||
service, node, schema, item_id, extra, profile_key
|
||||
)
|
||||
|
|
@ -103,18 +95,8 @@ class Tickets(object):
|
|||
return d
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def set(
|
||||
self,
|
||||
client,
|
||||
service,
|
||||
node,
|
||||
values,
|
||||
schema=None,
|
||||
item_id=None,
|
||||
extra=None,
|
||||
deserialise=False,
|
||||
form_ns=NS_TICKETS,
|
||||
):
|
||||
def set(self, client, service, node, values, schema=None, item_id=None, extra=None,
|
||||
deserialise=False, form_ns=NS_TICKETS):
|
||||
"""Publish a tickets
|
||||
|
||||
@param node(unicode, None): Pubsub node to use
|
||||
|
|
@ -135,9 +117,9 @@ class Tickets(object):
|
|||
if not item_id:
|
||||
comments_service = yield self._m.getCommentsService(client, service)
|
||||
|
||||
# we need to use uuid for comments node, because we don't know item id in advance
|
||||
# (we don't want to set it ourselves to let the server choose, so we can have
|
||||
# a nicer id if serial ids is activated)
|
||||
# we need to use uuid for comments node, because we don't know item id in
|
||||
# advance (we don't want to set it ourselves to let the server choose, so we
|
||||
# can have a nicer id if serial ids is activated)
|
||||
comments_node = self._m.getCommentsNode(
|
||||
node + u"_" + unicode(shortuuid.uuid())
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue