WordPress.org

Making WordPress.org

Changeset 371


Ignore:
Timestamp:
02/04/2014 06:41:27 PM (6 years ago)
Author:
nacin
Message:

Update Trac patch to handle focus-based subscribers and new ticket subscribers. see #127, #287, #300.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/trac.wordpress.org/patches/notifications.diff

    r243 r371  
    11Index: trac-1.0.1/trac/ticket/notification.py
    22===================================================================
    3 --- trac-1.0.1/trac/ticket/notification.py  (revision 12333)
     3--- trac-1.0.1/trac/ticket/notification.py  (revision 12423)
    44+++ trac-1.0.1/trac/ticket/notification.py  (working copy)
    55@@ -29,6 +29,7 @@
     
    1111 
    1212 class TicketNotificationSystem(Component):
    13 @@ -94,6 +95,43 @@
     13@@ -94,6 +95,57 @@
    1414                 torecipients.append(row[2])
    1515             break
     
    2323+            milestone = ticket['milestone']
    2424+            old_milestone = milestone
     25+            focuses = ticket['focuses']
    2526+
    2627+            # Retrieve the old milestone/component if it just changed
     
    3738+                    if change[2] == 'milestone':
    3839+                        old_milestone = change[3]
     40+                    if change[2] == 'focuses' :
     41+                        focuses += ', ' + change[3]
     42+            else:
     43+                # Add new ticket subscribers
     44+                for row in db("SELECT username FROM _notifications WHERE type = 'newticket' AND value = '1'"):
     45+                    torecipients.append(row[0])
     46+
     47+            # Add focus subscribers
     48+            focuses = focuses.split(', ')
     49+            focuses = list(set(focuses)) # de-dupe
     50+            for row in db("""SELECT username FROM _notifications
     51+                WHERE type = 'focus' AND value IN ( %s )""" % ','.join(['%s']*len(focuses)), focuses):
     52+                torecipients.append(row[0])
    3953+
    4054+            # Add component subscribers
     
    5569         if notify_updater:
    5670             for author, ticket in db("""
    57 @@ -126,6 +164,12 @@
     71@@ -126,6 +178,12 @@
    5872         elif updater:
    5973             torecipients.append(updater)
Note: See TracChangeset for help on using the changeset viewer.