Skip to content
This repository
Browse code

Merge remote-tracking branch 'gaod/master'

  • Loading branch information...
commit 266fe5ddd1a25a5424f39ae83e85cb1260b9fcd0 2 parents 42bbd36 + b5b1d47
itota authored

Showing 1 changed file with 14 additions and 0 deletions. Show diff stats Hide diff stats

  1. +14 0 tracsubtickets/api.py
14 tracsubtickets/api.py
@@ -36,6 +36,7 @@
36 36 from trac.db import DatabaseManager
37 37 from trac.ticket.model import Ticket
38 38 from trac.ticket.api import ITicketChangeListener, ITicketManipulator
  39 +from trac.ticket.notification import TicketNotifyEmail
39 40
40 41 from trac.util.translation import domain_functions
41 42
@@ -149,10 +150,23 @@ def ticket_changed(self, ticket, comment, author, old_values):
149 150 for parent in old_parents - new_parents:
150 151 cursor.execute("DELETE FROM subtickets WHERE parent=%s AND child=%s",
151 152 (parent, ticket.id))
  153 + # add a comment to old parent
  154 + xticket = Ticket(self.env, parent)
  155 + xticket.save_changes(author, 'Remove a subticket #' + str(ticket.id) + '.')
  156 + tn = TicketNotifyEmail(self.env)
  157 + tn.notify(xticket, newticket=False, modtime=xticket['changetime'])
  158 +
  159 +
152 160 # add new parents
153 161 for parent in new_parents - old_parents:
154 162 cursor.execute("INSERT INTO subtickets VALUES(%s, %s)",
155 163 (parent, ticket.id))
  164 + # add a comment to new parent
  165 + xticket = Ticket(self.env, parent)
  166 + xticket.save_changes(author, 'Add a subticket #' + str(ticket.id) + '.')
  167 + tn = TicketNotifyEmail(self.env)
  168 + tn.notify(xticket, newticket=False, modtime=xticket['changetime'])
  169 +
156 170 db.commit()
157 171
158 172 def ticket_deleted(self, ticket):

0 comments on commit 266fe5d

Please sign in to comment.
Something went wrong with that request. Please try again.