Edgewall Software
Modify

Opened 12 years ago

Closed 5 years ago

#4582 closed defect (fixed)

Renaming a milestone doesn't update ticket history

Reported by: sdyson@… Owned by: Ryan J Ollos
Priority: normal Milestone: 1.0.2
Component: roadmap Version: 0.10
Severity: normal Keywords: tracobject datamodel milestone
Cc: itamarost@…
Release Notes:

Ticket change history is updated when renaming a milestone.

API Changes:

Description

If you rename a milestone the milestone on associated tickets is updated to reflect the change. However in the ticket history, where it says 'milestone set to x' or 'milestone changed from x to y', the milestone name hasn't been updated. Only a minor issue but still a little irritating.

Attachments (0)

Change History (12)

comment:1 Changed 12 years ago by Christian Boos

Keywords: tracobject datamodel added
Milestone: 0.12

This is an example of batch ticket change. #525 talks mainly about the UI for this, but we should also consider the problem from the API side.

This is even an example of a "cross resource" change set, as renaming a milestone also triggers a change in the milestone property of all the related tickets.

comment:2 Changed 11 years ago by osimons

#5897 closed as duplicate.

comment:3 Changed 10 years ago by Christian Boos

See also closely related #5658.

comment:4 Changed 8 years ago by Remy Blank

See #5658 for the same issue when re-targeting tickets on milestone completion.

comment:5 Changed 8 years ago by Itamar Ostricher

Cc: itamarost@… added

comment:6 Changed 6 years ago by Ryan J Ollos <ryan.j.ollos@…>

I investigated this briefly as a possible follow-on to #5658 if the patch is accepted there. It looks like we'd want to add an author parameter to the update method. The delete method already has an author parameter. We'd have to decide whether notifications should be sent. I'd lean towards no notifications.

  • trac-trunk/trac/ticket/model.py

     
    10481048        for listener in TicketSystem(self.env).milestone_change_listeners:
    10491049            listener.milestone_created(self)
    10501050
    1051     def update(self, db=None):
     1051    def update(self, db=None, author=None):
    10521052        """Update the milestone.
    10531053
    10541054        :since 1.0: the `db` parameter is no longer needed and will be removed
     
    10721072                # Update milestone field in tickets
    10731073                self.env.log.info("Updating milestone field of all tickets "
    10741074                                  "associated with milestone '%s'", self.name)
     1075                when = datetime.now(utc)
     1076                comment = _("Milestone renamed.")
     1077                for id, in db("SELECT id FROM ticket WHERE milestone=%s", (old_name,)):
     1078                    t = Ticket(self.env, int(id))
     1079                    t['milestone'] = self.name
     1080                    t.save_changes(author, comment, when)
    10751081                db("UPDATE ticket SET milestone=%s WHERE milestone=%s",
    10761082                   (self.name, old_name))
    10771083                TicketSystem(self.env).reset_ticket_fields()
  • trac-trunk/trac/ticket/admin.py

     
    268268                                            _('Invalid Completion Date'))
    269269                    mil.description = req.args.get('description', '')
    270270                    try:
    271                         mil.update()
     271                        mil.update(req.authname)
    272272                    except self.env.db_exc.IntegrityError:
    273273                        raise TracError(_('The milestone "%(name)s" already '
    274274                                          'exists.', name=name))
Last edited 5 years ago by Ryan J Ollos (previous) (diff)

comment:7 Changed 6 years ago by Christian Boos

Milestone: next-major-releases1.0.2

comment:8 Changed 6 years ago by Christian Boos

Is the patch in comment:6 the one to be reviewed or did you plan an update?

comment:9 Changed 6 years ago by Ryan J Ollos <ryan.j.ollos@…>

Cc: ryan.j.ollos@… added

Some updates might be needed after #5658 is integrated, and I also had some questions in comment:6, but I felt like the patch captured the essential changes that needed to be made.

Another option is that I could combine the two patches, so just let me know what is easiest to handle on your end. Either way, I'm around and have time to commit to furthering the patches, so I can follow-up with a new patch soon, or within a few days of #5658 being integrated.

comment:10 Changed 5 years ago by Ryan J Ollos

Owner: changed from Christopher Lenz to Ryan J Ollos
Status: newassigned

comment:11 Changed 5 years ago by Ryan J Ollos

Cc: ryan.j.ollos@… removed
Keywords: milestone added

comment:12 Changed 5 years ago by Ryan J Ollos

Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

See comment:50:ticket:5658 for a description of the changes.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted.
to The owner will be changed from Ryan J Ollos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.