diff libervia/pages/merge-requests/view/page_meta.py @ 1378:e3e303a30a74

pages (tickets): renamed "tickets" to "lists": "lists" is more generic, and tickets is actually a specific kind of list. /!\ "tickets_trackers_json" option has been renamed to "lists_directory_json".
author Goffi <goffi@goffi.org>
date Thu, 28 Jan 2021 18:51:44 +0100
parents 04e7dd6b6f4d
children 907f519faaf0
line wrap: on
line diff
--- a/libervia/pages/merge-requests/view/page_meta.py	Fri Dec 11 17:35:06 2020 +0100
+++ b/libervia/pages/merge-requests/view/page_meta.py	Thu Jan 28 18:51:44 2021 +0100
@@ -5,7 +5,6 @@
 from sat.core.i18n import _
 from libervia.server.utils import SubPage
 from libervia.server import session_iface
-from twisted.internet import defer
 from twisted.words.protocols.jabber import jid
 from sat.tools.common import template_xmlui
 from sat.tools.common import uri
@@ -22,21 +21,21 @@
     try:
         item_id = self.nextPath(request)
     except IndexError:
-        log.warning(_("no ticket id specified"))
+        log.warning(_("no list item id specified"))
         self.pageError(request, C.HTTP_BAD_REQUEST)
 
     data = self.getRData(request)
-    data["ticket_id"] = item_id
+    data["list_item_id"] = item_id
 
 
 async def prepare_render(self, request):
     data = self.getRData(request)
     template_data = request.template_data
     session = self.host.getSessionData(request, session_iface.ISATSession)
-    service, node, ticket_id = (
+    service, node, list_item_id = (
         data.get("service", ""),
         data.get("node", ""),
-        data["ticket_id"],
+        data["list_item_id"],
     )
     profile = self.getProfile(request)
 
@@ -49,18 +48,18 @@
             service.full() if service else "",
             node,
             C.NO_LIMIT,
-            [ticket_id],
+            [list_item_id],
             "",
             {"parse": C.BOOL_TRUE, "labels_as_list": C.BOOL_TRUE},
             profile,
         )
     )
-    ticket = template_xmlui.create(
+    list_item = template_xmlui.create(
         self.host, merge_requests['items'][0], ignore=["request_data", "type"]
     )
-    template_data["item"] = ticket
+    template_data["item"] = list_item
     template_data["patches"] = merge_requests['items_patches'][0]
-    comments_uri = ticket.widgets["comments_uri"].value
+    comments_uri = list_item.widgets["comments_uri"].value
     if comments_uri:
         uri_data = uri.parseXMPPUri(comments_uri)
         template_data["comments_node"] = comments_node = uri_data["node"]
@@ -73,19 +72,19 @@
 
     if session.connected:
         # we set edition URL only if user is the publisher or the node owner
-        publisher = jid.JID(ticket.widgets["publisher"].value)
+        publisher = jid.JID(list_item.widgets["publisher"].value)
         is_publisher = publisher.userhostJID() == session.jid.userhostJID()
         affiliation = None
         if not is_publisher:
             node = node or self.host.ns_map["merge_requests"]
             affiliation = await self.host.getAffiliation(request, service, node)
         if is_publisher or affiliation == "owner":
-            template_data["url_ticket_edit"] = self.getURLByPath(
+            template_data["url_list_item_edit"] = self.getURLByPath(
                 SubPage("merge-requests"),
                 service.full(),
                 node or "@",
                 SubPage("merge-requests_edit"),
-                ticket_id,
+                list_item_id,
             )