Edgewall Software

Ticket #2247: 005_no-self-notify.patch

File 005_no-self-notify.patch, 1.7 KB (added by Sebastian Krysmanski <sebastian@…>, 3 years ago)

Patch against Trac 0.11.4

  • trac/ticket/notification.py

    # This patch provides an option to disable ticket notifications about changes
    # done by the user itself. It'll still be notified about changes made by others.
    old new  
    4141                                       'true', 
    4242        """Always send notifications to the person who causes the ticket  
    4343        property change.""") 
     44 
     45    notify_own_changes = BoolOption('notification', 'notify_own_changes', 
     46                                    'false', 
     47        """Send notifications even if it was triggered by the user itself. If  
     48        this option is "false" all recipients will only be notified about  
     49        changes made by other users.""") 
    4450         
    4551    ticket_subject_template = Option('notification', 'ticket_subject_template',  
    4652                                     '$prefix #$ticket.id: $summary', 
     
    235241                                           'always_notify_owner') 
    236242        notify_updater = self.config.getbool('notification',  
    237243                                             'always_notify_updater') 
     244        notify_own_changes = self.config.getbool('notification',  
     245                                                 'notify_own_changes') 
    238246 
    239247        ccrecipients = self.prev_cc 
    240248        torecipients = [] 
     
    282290                torecipients = [r for r in torecipients if r and r != updater] 
    283291        elif updater: 
    284292            torecipients.append(updater) 
     293             
     294        if not notify_own_changes and updater: 
     295            torecipients = [r for r in torecipients if r != updater] 
     296            ccrecipients = [r for r in ccrecipients if r != updater] 
    285297 
    286298        return (torecipients, ccrecipients) 
    287299