On 28/4/2010 4:04 AM, Felix Schwarz wrote:
Am 27.04.2010 09:31, schrieb Josh Godsiff:
My company is looking to extend Trac in order to allow us to specify
certain comments as being public or private (depending on whether we go
with blacklist or whitelist approach).

I would assume that the best way to go about this would be to create a
plugin implementing the ITicketChangeListener interface. (If not, what
would?)

Actually it's not that simple as there is no interface that already does what you need.

I'd recommend the following approach:
1. Write something so you can suppress some comments from being shown:
   for example just the first comment (=> proof that you can add your
   own logic).
   Could be that you have to modify Ticket.get_changelog. Which in turn
   requires to write your own TicketModule+TicketSystem (or modify the
   existing ones with inheritance)
2. Decide how you store the public/private data (might be hard because
   of the denormalized storage of comments)
3. Write a ticket change listener as you proposed
4. inject your UI (can be done by an IRequestFilter)
5. write a some RequestHandler so you can set/unset the public/private
   for a comment

HTH
fs


Ok, we managed to bypass most of that by scrapping the checkbox and and just adding a string ('[public]') to the comment itself, and then adding a couple of lines to grouped_changelog_entries in ticket/web_ui.py

However, we'd like the process to be transparent (and non-optional) for certain users. Essentially, we want to prepend '[public]' to the comment on the way into the database if a user lacks certain permissions (and/or is part of a certain usergroup). Where/how is it best to go about this? We don't mind hacking around in the core, but if there's a maintainable way that's just as easy, that would be better.

Thanks
- Josh

--
You received this message because you are subscribed to the Google Groups "Trac 
Development" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/trac-dev?hl=en.

Reply via email to