Edgewall Software

Changes between Initial Version and Version 2 of Ticket #13029


Ignore:
Timestamp:
May 17, 2018, 1:01:25 PM (6 years ago)
Author:
Jun Omae
Comment:

And this works well most of the time, but I still get a notification when I attach a file to a ticket.

I tested the case on Trac 1.2.2 but works for me.

browser:trunk/trac/ticket/notification.py@16368:683#L658​ is this correct when the attachment is not added by the ticket reporter?

You're right. We should use attachment.author as author argument.

  • trac/ticket/notification.py

    diff --git a/trac/ticket/notification.py b/trac/ticket/notification.py
    index 92957d016..e34cda923 100644
    a b class TicketAttachmentNotifier(Component):  
    896896
    897897    def attachment_added(self, attachment):
    898898        self._notify_attachment(attachment, 'attachment added',
    899                                 attachment.date)
     899                                attachment.date, attachment.author)
    900900
    901901    def attachment_deleted(self, attachment):
    902         self._notify_attachment(attachment, 'attachment deleted', None)
     902        self._notify_attachment(attachment, 'attachment deleted', None, None)
    903903
    904904    def attachment_reparented(self, attachment, old_parent_realm,
    905905                              old_parent_id):
    class TicketAttachmentNotifier(Component):  
    907907
    908908    # Internal methods
    909909
    910     def _notify_attachment(self, attachment, category, time):
     910    def _notify_attachment(self, attachment, category, time, author):
    911911        resource = attachment.resource.parent
    912912        if resource.realm != 'ticket':
    913913            return
    914914        ticket = Ticket(self.env, resource.id)
    915         event = TicketChangeEvent(category, ticket, time, ticket['reporter'],
     915        event = TicketChangeEvent(category, ticket, time, author,
    916916                                  attachment=attachment)
    917917        try:
    918918            NotificationSystem(self.env).notify(event)

However, author is not available when deleting attachment. I consider we should implement the notification in AttachmentModule.process_request to pass req.authname to the author.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #13029

    • Property Version1.2.2
    • Property Type enhancementdefect
  • Ticket #13029 – Description

    initial v2  
    11I have configured:
    2 "
    3 Subscription rules:
    4 Never notify: I update a ticket
    5 "
     2
     3  Subscription rules:
     4  Never notify: I update a ticket
     5
    66And this works well most of the time, but I still get a notification when I attach a file to a ticket.