Index: trac/attachment.py =================================================================== --- trac/attachment.py (revision 6106) +++ trac/attachment.py (working copy) @@ -33,6 +33,8 @@ from trac.env import IEnvironmentSetupParticipant from trac.perm import PermissionError, PermissionSystem, IPermissionPolicy from trac.mimeview import * +from trac.ticket import Ticket +from trac.ticket.notification import TicketNotifyEmail from trac.timeline.api import TimelineEvent from trac.util import get_reporter_id, create_unique_file, content_disposition from trac.util.datefmt import to_timestamp, utc @@ -551,6 +553,15 @@ pass # don't worry if there's nothing to replace attachment.filename = None attachment.insert(filename, upload.file, size) + if attachment.parent_realm == 'ticket': + try: + tn = TicketNotifyEmail(self.env) + # have to get the ticket that the attachment will modify + ticket = Ticket(self.env, tkt_id=attachment.parent_id) + tn.notify(ticket, newticket=False, modtime=attachment.time) + except Exception, e: + self.log.exception("Failure sending notification for attachment " + "on ticket #%s: %s" % (ticket.id, e)) # Redirect the user to list of attachments (must add a trailing '/') req.redirect(context.resource_href('..') + '/')