Modify

Opened 12 years ago

Closed 12 years ago

#252 closed setup (fixed)

Option to automatically add reporter to ticket cc field

Reported by: kofal002@… Owned by: bas
Priority: major Milestone: New email2trac release 2.4.0
Component: email2trac Version: 2.1.0
Keywords: Cc:

Description

Hello,

We're using a Trac instance for both internal and customer-facing ticket reports, and want to be able to reply to tickets to send a customer (the reporter on an auto-generated ticket). However, we don't want to use the always_notify_reporter option in Trac, to avoid mailing developers about normal tickets.

Thus, we need a way to mail a reporter about Email2Trac tickets only. I believe the easiest way to do this would be to set a cc field on ticket creation with the email of the reporter. However, to my knowledge a default_cc field in email2trac.conf would not accept a reporter variable.

Could there be an option to automatically add the reporter (which, with email2trac, will always be an email address) to the CC field of any new tickets?

Attachments (0)

Change History (5)

comment:1 Changed 12 years ago by anonymous

Ignoring configuration, this is pretty easy to do by simply adding this line to set_reply_fields (line 365 in latest version):

        ticket['cc'] = self.author

comment:2 Changed 12 years ago by bas

  • Status changed from new to assigned
  • Type changed from enhancement to setup

I just implemented workflow for ticket_updates and then realize that the same holds true for new tickets. So i have enabled workflow for new tickets and adjusted:

  • advancedworkflow

proof of concept and tested:

add these workflow definition:

class TicketWorkflowOpAddReporterToCC(TicketWorkflowOpBase):
    """Add reporter to CC field

    needinfo = * -> needinfo
    needinfo.name = Need info
    needinfo.operations = add_reporter_to_cc


    Don't forget to add the `TicketWorkflowOpAddReporterToCC` to the workflow
    option in [ticket].
    If there is no workflow option, the line will look like this:

    workflow = ConfigurableTicketWorkflow,TicketWorkflowOpAddReporterToCC
    """

    _op_name = 'add_reporter_to_cc'

    # ITicketActionController methods

    def render_ticket_action_control(self, req, ticket, action):
        """Returns the action control"""
        actions = self.get_configurable_workflow().actions
        label = actions[action]['name']
        hint = 'Put the reporter in  the CC field :  %s' % ticket['reporter']
        control = tag('')
        return (label, control, hint)

    def get_ticket_changes(self, req, ticket, action):
        """Returns the change of owner."""
        return {'cc': ticket['reporter']}

email2trac.conf:

workflow_new: email

trac.ini:

[ticket]
workflow = ConfigurableTicketWorkflow,TicketWorkflowOpAddReporterToCC

[ticket-workflow]
email = * -> new
email.name = email2trac
email.operations = add_reporter_to_cc

comment:3 Changed 12 years ago by bas

(In [545]) added email2trac_workflow function. So we now honor workflow for new tickets and ticket updates, see #252, #226

comment:4 Changed 12 years ago by bas

  • Milestone set to New email2trac release 2.4.0

comment:5 Changed 12 years ago by bas

  • Resolution set to fixed
  • Status changed from assigned to closed

Add Comment

Modify Ticket

Change Properties
Action
as closed The owner will remain bas.
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.