Making WordPress.org

Changeset 243


Ignore:
Timestamp:
01/08/2014 11:01:11 PM (11 years ago)
Author:
nacin
Message:

Trac patch: Avoid IndexError that could occur when new tickets are created.

File:
1 edited

Legend:

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

    r231 r243  
    1111 
    1212 class TicketNotificationSystem(Component):
    13 @@ -94,6 +95,41 @@
     13@@ -94,6 +95,43 @@
    1414                 torecipients.append(row[2])
    1515             break
     
    2626+            # Retrieve the old milestone/component if it just changed
    2727+            changes = ticket.get_changelog()
    28 +            changes.reverse()
    29 +            last_change = changes[0]
    30 +            for change in changes:
    31 +                if change[0] != last_change[0]:
    32 +                    break
    33 +                if change[2] == 'component':
    34 +                    old_component = change[3]
    35 +                if change[2] == 'milestone':
    36 +                    old_milestone = change[3]
     28+            # New tickets do not have changes
     29+            if changes:
     30+                changes.reverse()
     31+                last_change = changes[0]
     32+                for change in changes:
     33+                    if change[0] != last_change[0]:
     34+                        break
     35+                    if change[2] == 'component':
     36+                        old_component = change[3]
     37+                    if change[2] == 'milestone':
     38+                        old_milestone = change[3]
    3739+
    3840+            # Add component subscribers
     
    5355         if notify_updater:
    5456             for author, ticket in db("""
    55 @@ -126,6 +162,12 @@
     57@@ -126,6 +164,12 @@
    5658         elif updater:
    5759             torecipients.append(updater)
Note: See TracChangeset for help on using the changeset viewer.