django / code.djangoproject.com

Configuration for Django's Trac instance (code.djangoproject.com)
BSD 3-Clause "New" or "Revised" License
48 stars 40 forks source link

Enhancement: subscribe to components in Trac #202

Open medmunds opened 3 months ago

medmunds commented 3 months ago

Enhancement request for Django's Trac: add a way to subscribe to notifications on components. (forum discussion)

As a maintainer of a third-party library who uses Django's email APIs, I wish I could automatically be notified about all (future) tickets with "Component: Core (Email)."

I imagine this would involve:

For that second part, I can think of at least two approaches:

  1. Auto-add CC on watched components

    Whenever a ticket's component is modified, automatically add a CC for each user watching the new component.

    Pro: can easily "mute" an individual ticket within a watched component, by just removing yourself from the CC

    Con: might generate a lot of "CC modified" notification spam to other subscribers every time a ticket's component is changed or a user adds a component to their watch list

OR

  1. New subscription rule for "watched component" notifications

    In Trac's notification preferences, allow something like this mockup (where "watched component" would link to the preference for managing the watch list):

    Subscription rules list, highlighting hypothetical new rule named 'Notify: Ticket in watched component is created or modified'

    Pros/cons: reverse of the first approach

I don't have a strong preference (and don't know which would be easier).

Incidentally, it might also be helpful to watch keywords as well as components. (But my own current needs would be covered by components.)

bmispelon commented 3 months ago

I've hacked on this for a few hours yesterday and it seems like it might require some work, but it should be possible.

From your two proposals, I would go for number 2. It turns out that the hard part is letting a user manage a list of watched components (a requirement for both of your proposals if I understand correctly). Once you have that, it's fairly easy to write a plugin that integrates with Trac's notification system to notify users when a ticket matching their watched components is touched.

Once we have a plugin for watching components, it should be fairly easy to have the same for keywords (which seems like another good idea, thanks), but let's take it one hack step at a time 😁

medmunds commented 3 months ago

Oh, "should be possible" is a lot more positive than I'd hoped! :smile:

For managing the list of watched components, I was imagining a long list of checkboxes. Or to keep it easy, just a <select multiple> for now and improve it later. Presented in either a new preferences panel or a new child panel of Notifications/Subscriptions. And I guess stored in the user's session as a comma-separated list of component ids? (Haven't looked into Trac for over 20 years; apologies if this is all obvious stuff.)

Something like this mockup (which I generated by copying and pasting the <select> from Trac's query page, adding attrs for multiple and size=10 rows):

Trac 'Notifications' preferences panel, with proposed 'watched components' listbox showing three selected components

For managing watched keywords, the preferences panel could be even simpler: just a textedit to enter a comma-or-newline-separated list of keywords.