Making WordPress.org

Changeset 2033


Ignore:
Timestamp:
11/03/2015 03:48:55 AM (8 years ago)
Author:
nacin
Message:

Update Trac Notifications patch to account for focuses not being global.

Ticketfocuses? comes back as None when the custom field isn't registered for a particular Trac, which causes an attribute error for calling split().

File:
1 edited

Legend:

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

    r1175 r2033  
    11Index: trac-1.0.1/trac/ticket/notification.py
    22===================================================================
    3 --- trac-1.0.1/trac/ticket/notification.py  (revision 12423)
     3--- trac-1.0.1/trac/ticket/notification.py  (revision 14348)
    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,57 @@
     13@@ -94,6 +95,58 @@
    1414                 torecipients.append(row[2])
    1515             break
     
    4646+
    4747+            # 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])
     48+            if focuses:
     49+                focuses = focuses.split(', ')
     50+                focuses = list(set(focuses)) # de-dupe
     51+                for row in db("""SELECT username FROM _notifications
     52+                    WHERE type = 'focus' AND value IN ( %s )""" % ','.join(['%s']*len(focuses)), focuses):
     53+                    torecipients.append(row[0])
    5354+
    5455+            # Add component subscribers
     
    6970         if notify_updater:
    7071             for author, ticket in db("""
    71 @@ -126,6 +178,12 @@
     72@@ -126,6 +179,12 @@
    7273         elif updater:
    7374             torecipients.append(updater)
Note: See TracChangeset for help on using the changeset viewer.