Changeset 12333


Ignore:
Timestamp:
Nov 10, 2012, 12:57:39 AM (11 years ago)
Author:
Steffen Hoffmann
Message:

TracAnnouncer: Notify previous owner, when a ticket is reassigned, refs #6452.

Location:
announcerplugin/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • announcerplugin/trunk/announcer/subscribers.py

    r12332 r12333  
    119119        ticket = event.target
    120120
    121         if not ticket['owner'] or ticket['owner'] == 'anonymous':
    122             return
    123 
    124         if re.match(r'^[^@]+@.+', ticket['owner']):
    125             sid, auth, addr = None, 0, ticket['owner']
     121        if (not ticket['owner'] or ticket['owner'] == 'anonymous') and \
     122                not 'owner' in event.changes:
     123            return
     124
     125        if ticket['owner'] and ticket['owner'] != 'anonymous':
     126            if re.match(r'^[^@]+@.+', ticket['owner']):
     127                sid, auth, addr = None, 0, ticket['owner']
     128            else:
     129                sid, auth, addr = ticket['owner'], 1, None
     130            sid = None
     131        if 'owner' in event.changes:
     132            previous_owner = event.changes['owner']
     133            if re.match(r'^[^@]+@.+', previous_owner):
     134                sid_old, auth_old, addr_old = None, 0, previous_owner
     135            else:
     136                sid_old, auth_old, addr_old = previous_owner, 1, None
    126137        else:
    127             sid, auth, addr = ticket['owner'], 1, None
     138            sid_old = None
    128139
    129140        # Default subscription
    130141        for s in self.default_subscriptions():
    131             yield (s[0], s[1], sid, auth, addr, None, s[2], s[3])
    132 
     142            if sid:
     143                yield (s[0], s[1], sid, auth, addr, None, s[2], s[3])
     144            if sid_old:
     145                yield (s[0], s[1], sid_old, auth_old, addr_old, None, s[2],
     146                       s[3])
    133147        if sid:
    134148            klass = self.__class__.__name__
    135149            for s in Subscription.find_by_sids_and_class(self.env,
    136                     ((sid,auth),), klass):
     150                    ((sid, auth),), klass):
     151                yield s.subscription_tuple()
     152        if sid_old:
     153            klass = self.__class__.__name__
     154            for s in Subscription.find_by_sids_and_class(self.env,
     155                    ((sid_old, auth_old),), klass):
    137156                yield s.subscription_tuple()
    138157
  • announcerplugin/trunk/changelog

    r12326 r12333  
    55 resolved issues
    66 * #5774: No such table: subscriptions
     7 * #6452: No notification sent to previous owner when a ticket is reassigned
    78 * #7759: Update Account Manager Announcer for new subscription system
    89 * #7834: Emails are attempted to be sent even when there are no recipients
Note: See TracChangeset for help on using the changeset viewer.