Ticket #2247: trac-never-notify-self-2247.patch
| File trac-never-notify-self-2247.patch, 2.1 KB (added by nielsen@…, 3 years ago) |
|---|
-
trac/Notify.py
old new 159 159 modtime = 0 160 160 from_email = 'trac+ticket@localhost' 161 161 COLS = 75 162 current_user = None 162 163 163 def __init__(self, env ):164 def __init__(self, env, username): 164 165 NotifyEmail.__init__(self, env) 165 166 self.prev_cc = [] 167 self.current_user = username 166 168 167 169 def notify(self, ticket, newticket=True, modtime=0): 168 170 self.ticket = ticket … … 273 275 notify_reporter = val.lower() in TRUE 274 276 val = self.config.get('notification', 'always_notify_owner') 275 277 notify_owner = val.lower() in TRUE 278 val = self.config.get('notification', 'never_notify_self') 279 skip_current = val.lower() in TRUE 276 280 277 281 recipients = self.prev_cc 278 282 cursor = self.db.cursor() … … 303 307 # now convert recipients into email addresses where necessary 304 308 emails = [] 305 309 for recipient in recipients: 310 # Don't notify the current user 311 if skip_current and self.current_user: 312 if recipient == self.current_user or recipient == self.email_map[self.current_user]: 313 continue 306 314 if recipient.find('@') >= 0: 307 315 emails.append(recipient) 308 316 elif self.email_map.has_key(recipient): -
trac/ticket/web_ui.py
old new 143 143 144 144 # Notify 145 145 try: 146 tn = TicketNotifyEmail(self.env )146 tn = TicketNotifyEmail(self.env, req.authname) 147 147 tn.notify(ticket, newticket=True) 148 148 except Exception, e: 149 149 self.log.exception("Failure sending notification on creation of " … … 351 351 db.commit() 352 352 353 353 try: 354 tn = TicketNotifyEmail(self.env )354 tn = TicketNotifyEmail(self.env, req.authname) 355 355 tn.notify(ticket, newticket=False, modtime=now) 356 356 except Exception, e: 357 357 self.log.exception("Failure sending notification on change to "
