Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge remote-tracking branch 'gaod/master'

  • Loading branch information...
commit 266fe5ddd1a25a5424f39ae83e85cb1260b9fcd0 2 parents 42bbd36 + b5b1d47
itota authored
Showing with 14 additions and 0 deletions.
  1. +14 −0 tracsubtickets/api.py
14 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
@@ -149,10 +150,23 @@ def ticket_changed(self, ticket, comment, author, old_values):
for parent in old_parents - new_parents:
cursor.execute("DELETE FROM subtickets WHERE parent=%s AND child=%s",
(parent, ticket.id))
+ # 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:
cursor.execute("INSERT INTO subtickets VALUES(%s, %s)",
(parent, ticket.id))
+ # 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()
def ticket_deleted(self, ticket):
Please sign in to comment.
Something went wrong with that request. Please try again.