Modify

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#3094 closed enhancement (fixed)

A comment addition at the ticket under edit

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

Description

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 controller.py 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 6 years ago by retracile

  • Status changed from new to assigned

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 6 years ago by retracile

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

Rough implementation added in r3820.

Add Comment

Modify Ticket

Action
as closed .
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.