Edgewall Software
Modify

Opened 5 years ago

Closed 5 years ago

Last modified 3 years ago

#11926 closed defect (fixed)

Missing X-Trac-Ticket-URL header in ticket notification mail since 1.1.3

Reported by: Jun Omae Owned by: Jun Omae
Priority: normal Milestone: 1.1.4
Component: notification Version: 1.1.3
Severity: normal Keywords:
Cc: Branch:
Release Notes:

Fix missing X-Trac-Ticket-URL and X-Trac-Ticket-ID headers in ticket notification mail.

API Changes:

Add Ticket.get_comment_number(cdate) which returns a comment number by its date.

Description

We should add header like this.

X-Trac-Ticket-URL: http://trac-hacks.org/ticket/12158#comment:4
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
X-Trac-Realm: ticket
From: "My Project" <trac@localhost>
X-Trac-Version: 1.1.3
Precedence: bulk
Auto-Submitted: auto-generated
X-Mailer: Trac 1.1.3, by Edgewall Software
To: undisclosed-recipients: ;
References: <011.5820a89cc2c970d854f42757ba2afba4@localhost>
X-Trac-Project: My Project
In-Reply-To: <011.5820a89cc2c970d854f42757ba2afba4@localhost>
Date: Thu, 22 Jan 2015 04:58:51 -0000
Reply-To: trac@localhost
Message-ID: <026.95f8819ec9a6fc74629637032ed18e26@localhost>
X-URL: 
Subject: Re: [My Project] #1: test

#1: test
...

See th:#12158

Attachments (0)

Change History (4)

comment:1 by Peter Suter, 5 years ago

Makes sense. Previously we also had X-Trac-Ticket-ID apparently. TicketFormatter already implements a ticket specific IEmailDecorator, so we could add it there:

  • trac/ticket/notification.py

    diff -r 85498662a16a trac/ticket/notification.py
    a b  
    223223            notify.ticket = event.target
    224224            summary = event.target['summary']
    225225            subject = notify.format_subj(summary, event.category == 'created')
     226
     227            id = str(event.target.id)
     228            link = self.env.abs_href.ticket(id)
     229            set_header(message, 'X-Trac-Ticket-ID', id, charset)
     230            set_header(message, 'X-Trac-Ticket-URL', link, charset)
    226231        set_header(message, 'Subject', subject, charset)

I'm not sure how best to get the cnum for appending #comment:4 to the link.

Last edited 5 years ago by Peter Suter (previous) (diff)

in reply to:  1 comment:2 by Jun Omae, 5 years ago

Owner: set to Jun Omae
Status: newassigned

I'm not sure how best to get the cnum for appending #comment:4 to the link.

Proposed changes in jomae.git@t11926, which added Ticket.get_comment_number(cdate) for it.

comment:3 by Peter Suter, 5 years ago

Looks good to me. Thanks.

comment:4 by Jun Omae, 5 years ago

API Changes: modified (diff)
Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Thanks for the reviewing. Commtted in [13690-13691].

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jun Omae.
The resolution will be deleted. Next status will be 'reopened'.
to as closed The owner will be changed from Jun Omae to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.