Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#3094 closed enhancement (fixed)

A comment addition at the ticket under edit

Reported by: anonymous Owned by: Eli Carter
Priority: normal Component: AdvancedTicketWorkflowPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11


Would you make it add the comment like "duplicated #nn" also to the ticket under edit, although a comment is added to the inputted ticket number?

For example, they are the following touch.

    def get_ticket_changes(self, req, ticket, action):
        """Returns no changes."""
        return {}

Above is source of of revision 3730 line 380 - 382.

For example, how is correcting as follows?

    def get_ticket_changes(self, req, ticket, action):
        id = 'action_%s_xref' % action
        ticketnum = req.args.get(id).strip('#')
        comment = req.args.get('comment')
        if comment != '':
          comment = comment + '[[br]]\n'
        comment = comment + 'duplicated #%s' % ticketnum
        req.args['comment'] = comment
        return {}

Attachments (0)

Change History (2)

comment:1 Changed 9 years ago by Eli Carter

Status: newassigned

Reworking your suggestion, I think you'd want something closer to:

def get_ticket_changes(self, req, ticket, action):
    """Returns no changes, but injects a change into the comment."""
    format_string = actions[action].get('xref_local',
        'Ticket %s was marked as related to this ticket')
    if format_string:
        id = 'action_%s_xref' % action
        ticketnum = req.args.get(id, '')
        local_ref = format_string % ticketnum
        comment = req.args.get('comment', '')
        if local_ref not in comment:
            if comment:
                comment += '\n\n'
            comment += local_ref + '\n'
        req.args['comment'] = comment
    return {}

(Completely untested!)

There are a number of problems though...

  • get_ticket_changes is defined as not having side effects.
  • previewing this change, and setting a different ticket number, will cause multiple xref comments.

So I think both sides have to be done in the side-effect stage.

comment:2 Changed 9 years ago by Eli Carter

Resolution: fixed
Status: assignedclosed

Rough implementation added in r3820.

Modify Ticket

as closed The owner will remain Eli Carter.
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.