Modify

Opened 15 years ago

Closed 11 years ago

Last modified 11 years ago

#6237 closed enhancement (fixed)

Email Changes in Ticket

Reported by: shubham_chakraborty@… Owned by: Alexander von Bremen-Kühne
Priority: normal Component: TicketTeamDispatcherPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11

Description

This is in reference to ticket #6201 Please try making a ticketTeamdispatcher plugin send out notifications for subsequent changes done to the ticket to the Team selected.

This is because the point of having edit notifications being sent is that for example, 10 people on a team working on a ticket to solve...if subsequent notifcation arent sent, then unless each and everyone explicitly watches (watchlist plugin) or start working on it (worklog plugin), the ticket status remains unknown to them till the next time he checks on it. So upon closure by another member(with ticket_modify perm ofcourse), the other members could simply be working on an already closed ticket.

Also,if the Team needs to be changed, that is a new team to be assigned if the current team isnt capable..or as for corporate environments (ticket transferred between Onsite and Offshore members). In these cases, notifications for changes ALSO would be appreciated.

:) thnx

Attachments (0)

Change History (7)

comment:1 Changed 11 years ago by Adam Dorsey - NOAA Affiliate

Seconded, I am running into this issue now as well.

comment:2 Changed 11 years ago by Adam Dorsey - NOAA Affiliate

Solution listed at #6201:

You just have to adjust 0.11/ttd/api.py and replace the Lines saying 'pass' with these two lines:

mail = SpecialTicketNotifyEmail(self.env) mail.notify(ticket)

Last edited 11 years ago by Ryan J Ollos (previous) (diff)

comment:3 Changed 11 years ago by Adam Dorsey - NOAA Affiliate

I am currently working on an update that will allow configuring email notifications for creation, change and deletion of tickets. Once this is complete and I obtain permission to commit my changes, this issue will be resolved.

comment:4 Changed 11 years ago by Adam Dorsey - NOAA Affiliate

Add the ability to configure whether emails are sent on ticket creation, modification or deletion. These options are configured under the [ttd] section of trac.ini as follows:

email_on_create: Boolean (true|false), send email on ticket creation email_on_change: Boolean (true|false), send email on ticket modification email_on_delete: Boolean (true|false), send email on ticket deletion

For now these options will need to be entered manually on ticket install. Web admin entries and defaults will come later.

Diff of changes:

  • ttd/api.py

     
    11from trac.core import Component, implements
    22from trac.ticket.api import ITicketChangeListener
     3from datetime import datetime
     4from trac.util.datefmt import utc
    35
    46#local
    57from notification import SpecialTicketNotifyEmail
     
    810    implements(ITicketChangeListener)
    911
    1012    def ticket_created(self, ticket):
    11         mail = SpecialTicketNotifyEmail(self.env)
    12         mail.notify(ticket)
     13        do_mail = self.config.getbool('ttd', 'email_on_create')
     14        if do_mail:
     15            mail = SpecialTicketNotifyEmail(self.env)
     16            mail.notify(ticket)
    1317
    1418    def ticket_changed(self, ticket, comment, author, old_values):
    15         pass
     19        do_mail = self.config.getbool('ttd', 'email_on_change')
     20        if do_mail:
     21            now = datetime.now(utc)
     22            mail = SpecialTicketNotifyEmail(self.env)
     23            mail.notify(ticket, False, now)
    1624
    1725    def ticket_deleted(self, ticket):
    18         pass
     26        do_mail = self.config.getbool('ttd', 'email_on_delete')
     27        if do_mail:
     28            now = datetime.now(utc)
     29            mail = SpecialTicketNotifyEmail(self.env)
     30            mail.notify(ticket, False, now)
     31

I can commit this if I can get permission to do so (I get a 403 Forbidden when I attempt to do so at the moment)

Edit: Updated diff.

Last edited 11 years ago by Ryan J Ollos (previous) (diff)

comment:5 Changed 11 years ago by Ryan J Ollos

Resolution: fixed
Status: newclosed

In 13586:

0.3dev: Added options that determine when notifications are set:

  • notify_on_create (default: True)
  • notify_on_change (default: False)
  • notify_on_delete (default: False)

Initial patch by asdorsey. Fixes #6237.

comment:6 Changed 11 years ago by Ryan J Ollos

The basics of the patch are okay, but there are some subtle issue:

  • When adding options to a plugin, the Option class or subclasses such as BoolOption should be used: browser:/branches/1.0-stable/trac/config.py@12430:641#L641
  • I used notify rather than email in the option names, since it seems to be more consistent with the Trac nomenclature.
  • I used team-dispatcher as the section name since ttd isn't very descriptive.
  • The ticket changes were not being included in the notification. The modtime is used to lookup the changelog entries, so we need to use the ticket's changetime (which will equal the modtime of the change that we are sending the notification for).
  • The email notification on ticket delete did not provide any indication that the ticket was being deleted, so I appended (delete) to the Summary (which becomes the subject of the email).

Please test out the latest and report any issues you find.

Side note: Eventually, the AnnouncerPlugin (the core of which is being integrated to Trac for release 1.2), should provide equivalent functionality to this plugin through it's subscriber mechanism.

Last edited 11 years ago by Ryan J Ollos (previous) (diff)

comment:7 Changed 11 years ago by Adam Dorsey - NOAA Affiliate

Just tested the new functionality, it looks great. Emails are being sent on ticket modification and deletion once the plugin is configured. I was wondering why the comments weren't showing up, thanks for the info on that function.

And thanks for the tips on plugin development, Trac hacks are somewhat new to me :)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Alexander von Bremen-Kühne.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.