Permalink
Browse files

When a subticket changing parent, send a notification of both new & o…

…ld parent ticket.
  • Loading branch information...
1 parent 303f9e9 commit b5b1d476506c1d3dc3fd8d817f281cd13f6787a5 @gaod gaod committed Sep 10, 2012
Showing with 6 additions and 0 deletions.
  1. +6 −0 tracsubtickets/api.py
View
@@ -36,6 +36,7 @@
from trac.db import DatabaseManager
from trac.ticket.model import Ticket
from trac.ticket.api import ITicketChangeListener, ITicketManipulator
+from trac.ticket.notification import TicketNotifyEmail
from trac.util.translation import domain_functions
@@ -152,6 +153,9 @@ def ticket_changed(self, ticket, comment, author, old_values):
# add a comment to old parent
xticket = Ticket(self.env, parent)
xticket.save_changes(author, 'Remove a subticket #' + str(ticket.id) + '.')
+ tn = TicketNotifyEmail(self.env)
+ tn.notify(xticket, newticket=False, modtime=xticket['changetime'])
+
# add new parents
for parent in new_parents - old_parents:
@@ -160,6 +164,8 @@ def ticket_changed(self, ticket, comment, author, old_values):
# add a comment to new parent
xticket = Ticket(self.env, parent)
xticket.save_changes(author, 'Add a subticket #' + str(ticket.id) + '.')
+ tn = TicketNotifyEmail(self.env)
+ tn.notify(xticket, newticket=False, modtime=xticket['changetime'])
db.commit()

0 comments on commit b5b1d47

Please sign in to comment.