Implement ticket.ref()
Returning the ticket reference string ~user/tracker#scoped_id.
This commit is contained in:
parent
be993d8a07
commit
9e051e71b7
|
@ -22,9 +22,9 @@ def test_assignment(mailbox):
|
|||
|
||||
assert len(mailbox) == 1
|
||||
assert mailbox[0].to == assignee1.email
|
||||
assert mailbox[0].subject == "~foo/bar/#1: Hilfe!"
|
||||
assert mailbox[0].subject == "~foo/bar#1: Hilfe!"
|
||||
assert mailbox[0].body.startswith(
|
||||
"You were assigned to ~foo/bar/#1 by ~assigner")
|
||||
"You were assigned to ~foo/bar#1 by ~assigner")
|
||||
|
||||
# Assignment is idempotent
|
||||
assign(ticket, assignee1, assigner)
|
||||
|
@ -37,9 +37,9 @@ def test_assignment(mailbox):
|
|||
|
||||
assert len(mailbox) == 2
|
||||
assert mailbox[1].to == assignee2.email
|
||||
assert mailbox[1].subject == "~foo/bar/#1: Hilfe!"
|
||||
assert mailbox[1].subject == "~foo/bar#1: Hilfe!"
|
||||
assert mailbox[1].body.startswith(
|
||||
"You were assigned to ~foo/bar/#1 by ~assigner")
|
||||
"You were assigned to ~foo/bar#1 by ~assigner")
|
||||
|
||||
unassign(ticket, assignee1, assigner)
|
||||
db.session.commit()
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{{! vim: set ft=email }}
|
||||
You were assigned to {{ ticket_path }} by {{ assigner }}.
|
||||
You were assigned to {{ ticket_ref }} by {{ assigner }}.
|
||||
|
||||
--
|
||||
|
||||
|
|
|
@ -69,12 +69,7 @@ def _create_event_notification(user, event):
|
|||
return notification
|
||||
|
||||
def _send_comment_notification(subscription, ticket, user, comment, resolution):
|
||||
subject = "Re: {}/{}/#{}: {}".format(
|
||||
ticket.tracker.owner.canonical_name,
|
||||
ticket.tracker.name,
|
||||
ticket.scoped_id,
|
||||
ticket.title)
|
||||
|
||||
subject = "Re: {}: {}".format(ticket.ref(), ticket.title)
|
||||
headers = {
|
||||
"From": "~{} <{}>".format(user.username, notify_from),
|
||||
"Sender": smtp_user,
|
||||
|
@ -180,12 +175,7 @@ def notify_assignee(subscription, ticket, assigner, assignee):
|
|||
"""
|
||||
Sends a notification email to the person who was assigned to the issue.
|
||||
"""
|
||||
ticket_path = "{}/{}/#{}".format(
|
||||
ticket.tracker.owner.canonical_name,
|
||||
ticket.tracker.name,
|
||||
ticket.scoped_id)
|
||||
subject = "{}: {}".format(ticket_path, ticket.title)
|
||||
|
||||
subject = "{}: {}".format(ticket.ref(), ticket.title)
|
||||
headers = {
|
||||
"From": "~{} <{}>".format(assigner.username, notify_from),
|
||||
"Sender": smtp_user,
|
||||
|
@ -193,7 +183,7 @@ def notify_assignee(subscription, ticket, assigner, assignee):
|
|||
|
||||
context = {
|
||||
"assigner": assigner.canonical_name,
|
||||
"ticket_path": ticket_path,
|
||||
"ticket_ref": ticket.ref(),
|
||||
"ticket_url": ticket_url(ticket)
|
||||
}
|
||||
|
||||
|
|
|
@ -61,3 +61,9 @@ class Ticket(Base):
|
|||
assigned_users = sa.orm.relationship("User",
|
||||
secondary="ticket_assignee",
|
||||
foreign_keys="[TicketAssignee.ticket_id,TicketAssignee.assignee_id]")
|
||||
|
||||
def ref(self):
|
||||
return "{}/{}#{}".format(
|
||||
self.tracker.owner.canonical_name,
|
||||
self.tracker.name,
|
||||
self.scoped_id)
|
||||
|
|
Loading…
Reference in New Issue