# HG changeset patch
# Parent d09d67a750ae89b79586afbcac4a3f43777a5757
Also send attachment's description in the body of the notification mail. Applies on top of [attachment:attachment_0.13dev.2.patch].
diff -r d09d67a750ae -r 218983e06837 trac/ticket/notification.py
a
|
b
|
class TicketNotifyEmail(NotifyEmail):
|
137 | 137 | ticket.fields = translated_fields |
138 | 138 | reactivate(t) |
139 | 139 | |
140 | | def notify_attachment(self, ticket, author, filename, modtime, add): |
| 140 | def notify_attachment(self, ticket, author, filename, modtime, body): |
141 | 141 | """Send ticket attachment notification (untranslated)""" |
142 | 142 | t = deactivate() |
143 | 143 | translated_fields = ticket.fields |
… |
… |
class TicketNotifyEmail(NotifyEmail):
|
159 | 159 | ticket_values['new'] = self.newticket |
160 | 160 | ticket_values['link'] = link |
161 | 161 | subject = 'Re: ' + self.format_subj(summary) |
162 | | body = '%s attachment "%s"' % (add and 'Add' or 'Delete', filename) |
163 | 162 | author = obfuscate_email_address(author) |
164 | | change = { 'author': author } |
| 163 | change = {'author': author} |
165 | 164 | self.data.update({ |
166 | 165 | 'ticket_props': self.format_props(), |
167 | 166 | 'ticket_body_hdr': self.format_hdr(), |
… |
… |
class TicketAttachmentNotifier(Component
|
492 | 491 | tn = TicketNotifyEmail(self.env) |
493 | 492 | filename = attachment.filename |
494 | 493 | date = attachment.date or datetime.now(utc) |
495 | | tn.notify_attachment(ticket, author, filename, date, add) |
| 494 | # Note: no translation yet |
| 495 | if add: |
| 496 | body = "Attachment \"%s\" added." % filename |
| 497 | else: |
| 498 | body = "Attachment \"%s\" removed." % filename |
| 499 | if attachment.description: |
| 500 | body += "\n\n" + attachment.description |
| 501 | tn.notify_attachment(ticket, author, filename, date, body) |