Modify ↓
Opened 12 hours ago
Last modified 11 hours ago
#13873 assigned defect
Author of the event is incorrectly reporter of the ticket when new attachment
Reported by: | Jun Omae | Owned by: | Jun Omae |
---|---|---|---|
Priority: | normal | Milestone: | 1.6.1 |
Component: | notification | Version: | 1.2 |
Severity: | normal | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
When attaching a file to a ticket, event.author
is incorrectly ticket.reporter
. As the result, the from header of the notification mail is set to reporter's name of the ticket if [notification] smtp_from_author
is enabled.
Notification mail when user john
attaches new attachment:
Return-Path: <admin@trac.test> Received: from [127.0.0.1] (unknown [192.168.11.122]) by localhost (Postfix) with ESMTP id D15ED82414A; Sat, 22 Feb 2025 08:10:24 +0900 (JST) Content-Type: multipart/related; boundary="===============5893626379053615697==" MIME-Version: 1.0 X-Mailer: Trac 1.6, by Edgewall Software X-Trac-Version: 1.6 X-Trac-Project: 1.4-stable X-URL: X-Trac-Realm: ticket Precedence: bulk Auto-Submitted: auto-generated Message-ID: <032.21dfd7e2cac1ba6a2ef2e7f275a03b6d@trac.test> In-Reply-To: <017.bb364653e1866177057b6d70373da8db@trac.test> References: <017.bb364653e1866177057b6d70373da8db@trac.test> Date: Fri, 21 Feb 2025 23:10:24 -0000 To: admin@trac.test From: Admin <admin@trac.test> Reply-To: <> X-Trac-Ticket-ID: 28 X-Trac-Ticket-URL: http://192.168.11.122:3000/1.4-sqlite/ticket/28 Subject: Re: [1.4-stable] #28: Auhor in the notification when new attachment --===============5893626379053615697== MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit #28: Auhor in the notification when new attachment -------------------------+-------------------- Reporter: admin | Owner: (none) Type: defect | Status: new Priority: major | Milestone: Component: component1 | Version: Resolution: | Keywords: -------------------------+-------------------- Changes (by john): * Attachment "file-user.txt" added. -- Ticket URL: <http://192.168.11.122:3000/1.4-sqlite/ticket/28> 1.4-stable <http://192.168.11.122:3000/1.4-sqlite> My example project --===============5893626379053615697==--
Patch:
-
trac/ticket/notification.py
diff --git a/trac/ticket/notification.py b/trac/ticket/notification.py index 8e1f35174..36e12dda0 100644
a b class TicketAttachmentNotifier(Component): 733 733 if resource.realm != 'ticket': 734 734 return 735 735 ticket = Ticket(self.env, resource.id) 736 event = TicketChangeEvent(category, ticket, time, ticket['reporter'],736 event = TicketChangeEvent(category, ticket, time, attachment.author, 737 737 attachment=attachment) 738 738 try: 739 739 NotificationSystem(self.env).notify(event)
Attachments (0)
Note:
See TracTickets
for help on using tickets.
The
event.author
when an attachment is deleted is also incorrect caused by thatIAttachmentChangeListner.attachment_deleted()
doesn't provide the username which deleted it.