Modify

Opened 5 years ago

Closed 4 years ago

#7048 closed enhancement (fixed)

[PATCH] Add the ability to *not* modify ticket changetime field

Reported by: daltonmatos Owned by: CuriousCurmudgeon
Priority: normal Component: BatchModifyPlugin
Severity: normal Keywords:
Cc: Lianyungang, daltonmatos, CuriousCurmudgeon Trac Release: 0.11

Description

Hi,

I'm attaching here a patch that adds the ability to perform batch modifications without changing ticket's changetime field.

The motivation to this is the use of BatchModifyPlugin along with TracUnreadPlugin.

TracUnreadPlugin compares ticket's changetime with a last visit timestamp (that the plugin updates on every visit to the ticket) to know if a user has any unread comment.

But sometime there are changes that do not need to apear on everybody Recent changes report.

Could you please review the patch and apply, if appropriate?

Thanks,

Attachments (1)

donot-modify-ticket-changetime.patch (2.9 KB) - added by daltonmatos 5 years ago.
Add the ability do modify tickets without changing changetime field.

Download all attachments as: .zip

Change History (18)

Changed 5 years ago by daltonmatos

Add the ability do modify tickets without changing changetime field.

comment:1 Changed 5 years ago by daltonmatos

The patch was produced from version 0.4.1.

comment:2 follow-up: Changed 5 years ago by cna training

  • Cc Lianyungang added; daltonmatos removed

Keep posting stuff like this i really like it

comment:3 in reply to: ↑ 2 Changed 4 years ago by daltonmatos

  • Cc daltonmatos CuriousCurmudgeon added

Replying to cna training:

Keep posting stuff like this i really like it

Thanks, I hope this gets commited. Let's see.

comment:4 follow-up: Changed 4 years ago by CuriousCurmudgeon

(In [7936]) refs #7048

  • Applied patch from daltonmatos with some cosmetic changes to keep with the style of the rest of the plugin.

comment:5 Changed 4 years ago by CuriousCurmudgeon

  • Status changed from new to assigned

comment:6 Changed 4 years ago by CuriousCurmudgeon

Patch has been applied. Some testing would be appreciated from those that have time.

comment:7 in reply to: ↑ 4 Changed 4 years ago by daltonmatos

Replying to CuriousCurmudgeon:

(In [7936]) refs #7048

  • Applied patch from daltonmatos with some cosmetic changes to keep with the style of the rest of the plugin.

Thanks! I'll update my Trac instance very soon.

comment:8 Changed 4 years ago by daltonmatos

Thinking about this implementation, since will possible to make modifications that no other user will see, would be a good idea to create a new Trac permisison? This way normal users would still be able do make batch modifications, but this modifications will always be visible to others.

What do you think?

comment:9 Changed 4 years ago by CuriousCurmudgeon

(In [7939]) refs #7048

  • If no value is submitted for bmod_modify_changetime it will be set to False.

comment:10 Changed 4 years ago by CuriousCurmudgeon

The modified date is being set to 40 years ago if you choose not to modify the changetime. I think it has to do with microsecond vs second timestamps.

comment:11 follow-up: Changed 4 years ago by CuriousCurmudgeon

(In [7940]) refs #7048

  • Fixed changetime bug. Need to call to_utimestamp instead of to_timestamp. Trac stores timestamps in posix microseconds.
  • Bumped the version number to 0.5.0

comment:12 in reply to: ↑ 11 Changed 4 years ago by anonymous

Replying to CuriousCurmudgeon:

(In [7940]) refs #7048

  • Fixed changetime bug. Need to call to_utimestamp instead of to_timestamp. Trac stores timestamps in posix microseconds.
  • Bumped the version number to 0.5.0

Hi, Trac stores timestamps in microseconds only in version 0.12. see: http://trac.edgewall.org/wiki/TracDev/ApiChanges/0.12#Timestampstorageindatabase

0.11 still uses seconds resolution. So BatchModifyPlugin 0.5.0 ([7940]) does not work with Trac 0.11:

From the logs:

2010-05-13 08:26:07,397 Trac[loader] ERROR: Skipping "batchmod.web_ui = batchmod.web_ui":
 (can't import "ImportError: cannot import name to_utimestamp")

Please revert to [7939]. Actually [7940] is the patch necessary to make BatchModifyPlugin compatible with the new 0.12 Trac. =)

comment:13 Changed 4 years ago by CuriousCurmudgeon

The above comment is correct. I forgot about this change and was testing locally against the Trac trunk. I will revert the change and possibly create a 0.12 version of the plugin as well. This is the first difference between 0.11 and 0.12 that affects this plugin as far as I know.

comment:14 follow-up: Changed 4 years ago by CuriousCurmudgeon

(In [7942]) refs #7048

comment:15 in reply to: ↑ 14 Changed 4 years ago by daltonmatos

Replying to CuriousCurmudgeon:

Thaks, and that was me (comment:12), I just forgot to login first. =)

comment:16 Changed 4 years ago by CuriousCurmudgeon

(In [7943]) refs #7048

  • Created a 0.12 version of the plugin. This version uses microseconds for the timestamps.
  • Bumped the version number back to 0.5.0

comment:17 Changed 4 years ago by CuriousCurmudgeon

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

Closing as fixed. This is released with 0.5.0. Please reopen if any problems are found.

Add Comment

Modify Ticket

Action
as closed The owner will remain CuriousCurmudgeon.
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.