Add Tracker.ref() à la Ticket.ref(), replacing manual construxions
This commit is contained in:
parent
eff4ea1d86
commit
4270950afe
|
@ -52,8 +52,8 @@ def get_ticket_context(ticket, tracker, access):
|
|||
"tracker_sub": tracker_sub,
|
||||
"ticket_sub": ticket_sub,
|
||||
"recent_users": get_recent_users(tracker),
|
||||
"reply_to": f"mailto:{tracker.owner.canonical_name}/{tracker.name}/" +
|
||||
f"{ticket.scoped_id}@{posting_domain}?subject={reply_subject}"
|
||||
"reply_to": f"mailto:{ticket.ref(email=True)}@{posting_domain}" +
|
||||
f"?subject={reply_subject}"
|
||||
}
|
||||
|
||||
@ticket.route("/<owner>/<name>/<int:ticket_id>")
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
</p>
|
||||
<pre>{
|
||||
"description": <strong>$description</strong>,
|
||||
"ref": "{{tracker.owner.canonical_name}}/{{tracker.name}}#<strong>$id</strong>",
|
||||
"ref": "{{tracker.ref()}}#<strong>$id</strong>",
|
||||
"submitter": "~<strong>$username</strong>",
|
||||
"title": <strong>$title</strong>,
|
||||
"upstream": "{{get_origin('todo.sr.ht', external=True)}}",
|
||||
|
@ -48,7 +48,7 @@
|
|||
<pre>{
|
||||
"comment": <strong>$comment</strong>,
|
||||
"id": <strong>$id</strong>,
|
||||
"ticket": "{{tracker.owner.canonical_name}}/{{tracker.name}}#<strong>$id</strong>",
|
||||
"ticket": "{{tracker.ref()}}#<strong>$id</strong>",
|
||||
"user": "~<strong>$username</strong>",
|
||||
"upstream": "{{get_origin('todo.sr.ht', external=True)}}",
|
||||
}</pre>
|
||||
|
|
|
@ -147,7 +147,7 @@
|
|||
</a>
|
||||
to submit tickets, or
|
||||
<a
|
||||
href="mailto:{{tracker.owner.canonical_name}}/{{tracker.name}}@{{cfg("todo.sr.ht::mail", "posting-domain")}}"
|
||||
href="mailto:{{tracker.ref()}}@{{cfg("todo.sr.ht::mail", "posting-domain")}}"
|
||||
>submit via email</a>.
|
||||
{% endif %}
|
||||
{% else %}
|
||||
|
|
|
@ -91,6 +91,11 @@ class Tracker(Base):
|
|||
|
||||
return tracker, valid
|
||||
|
||||
def ref(self):
|
||||
return "{}/{}".format(
|
||||
self.owner.canonical_name,
|
||||
self.name)
|
||||
|
||||
def __repr__(self):
|
||||
return '<Tracker {} {}>'.format(self.id, self.name)
|
||||
|
||||
|
|
Loading…
Reference in New Issue