Improve automated commets

This commit is contained in:
Michal Čihař 2020-08-18 13:00:37 +02:00
parent bc0dd8301e
commit 57d039703b

View file

@ -39,6 +39,7 @@ TEMPLATE = """{
COMMENT_TEMPLATE = """ COMMENT_TEMPLATE = """
Ticket imported from Request Tracker Ticket imported from Request Tracker
URL: https://support.weblate.org/Ticket/Display.html?id={numerical_id}
Created: {Created} Created: {Created}
Resolved: {Resolved} Resolved: {Resolved}
""" """
@ -172,14 +173,14 @@ def get_user(userdata, attr="login"):
# Create tickets # Create tickets
for ticket in tickets: for ticket in tickets:
label = "RT-{}".format(ticket["ticket"]["id"].split("/")[1]) label = "RT-{}".format(ticket["ticket"]["numerical_id"])
print("Importing {}".format(label)) print("Importing {}".format(label))
new = get_zammad(get_user(users[ticket["ticket"]["Creator"]])).ticket.create( new = get_zammad(get_user(users[ticket["ticket"]["Creator"]])).ticket.create(
{ {
"title": "{} [{}]".format(ticket["ticket"]["Subject"], label), "title": "{} [{}]".format(ticket["ticket"]["Subject"], label),
"group": "Users", "group": "Users",
"state_id": STATUSMAP[ticket["ticket"]["Status"]], "state_id": STATUSMAP[ticket["ticket"]["Status"]],
"note": "RT-import:{}".format(ticket["ticket"]["id"]), "note": "RT-import:{}".format(ticket["ticket"]["numerical_id"]),
"article": { "article": {
"subject": ticket["ticket"]["Subject"], "subject": ticket["ticket"]["Subject"],
"body": ticket["history"][0]["Content"], "body": ticket["history"][0]["Content"],