Edgewall Software
Modify

Opened 4 years ago

Closed 4 years ago

Last modified 22 months ago

#11875 closed enhancement (fixed)

Notification subscriber config section

Reported by: Peter Suter Owned by: Peter Suter
Priority: normal Milestone: 1.1.5
Component: notification Version:
Severity: normal Keywords:
Cc:
Release Notes:

Added a new [notification-subscriber] config section for general configuration of notification subscription defaults, and replacing the [notification] always_notify_* options. Added a new SubscriberListMacro.

API Changes:

Added trac.notification.api.parse_subscriber_config(), NotificationSystem.notification_subscriber_section, NotificationSystem.subscriber_defaults and NotificationSystem.default_subscriptions().

Description

Trac already has a few notification config options to control default subscriptions:

  • always_notify_updater
  • always_notify_reporter
  • always_notify_owner
  • never_notify_self (soon?)

But we don't want always_notify_close_reporter_except_when_reporter_closed_the_ticket. :)

The new INotificationSubscriber makes it easy to add new such rules, but if we provide more implementations we may actually need more config options. Also there could now be different message formats, distribution transports, default subscription priorities (and required authentication and later maybe permissions and more).

We could instead try to add a [notification-subscriber] section:

[notification-subscriber]
always_notify_updater=TicketUpdaterSubscriber
always_notify_updater.default=email, 100, always, text/plain
always_notify_reporter=TicketReportedSubscriber
always_notify_reporter.default=email, 100, always, text/plain
always_notify_owner=TicketOwnerSubscriber
always_notify_owner.default=email, 100, always, text/plain

always_notify_owner.requires_authentication=True
always_notify_owner.permission=CUSTOM_CONFIG_NOTIFY_OWNER_PERMISSION
...

(Or some equivalent notation.)

Attachments (0)

Change History (15)

comment:1 Changed 4 years ago by Peter Suter

Milestone: next-dev-1.1.x1.1.3
Owner: set to Peter Suter
Status: newassigned

Proposed changes in psuter.hg@T11875-notification-subrscriber-config-section.

A preliminary steps changes the interface INotificationSubscriber so default_subscriptions() also yields format (e.g. 'text/plain').

A new parse_subscriber_config() function (similar to parse_workflow_config()) parses [notification-subscriber]. The result is cached in the NotificationSystem, and used to yield default subscriptions.

An upgrade step converts the old settings:

[notification]
always_notify_owner = true
always_notify_reporter = true
always_notify_updater = false

Creating a new section:

[notification-subscriber]
always_notify_cc = CarbonCopySubscriber
always_notify_owner = TicketOwnerSubscriber
always_notify_reporter = TicketReporterSubscriber

always_notify_updater = true would add two more lines:

always_notify_updater = TicketUpdaterSubscriber
always_notify_previous_updater= TicketPreviousUpdatersSubscriber

For a future never_notify_self (#2247) one could instead append:

never_notify_self = TicketUpdaterSubscriber
never_notify_self.adverb = never

Distributor, priority and format could also be changed:

always_notify_cc_via_xmpp = CarbonCopySubscriber
always_notify_cc_via_xmpp.distributor = xmpp
always_notify_cc_via_xmpp.priority = 200
always_notify_cc_via_xmpp.format = compact

(never_notify_self might benefit from a .priority = 99.)

Last edited 4 years ago by Peter Suter (previous) (diff)

comment:2 Changed 4 years ago by Peter Suter

Committed preliminary refactoring in [13552]: INotificationSubscriber.default_subscriptions() now includes the format (so it can easily be configured in this proposed [notification-subscriber] section.)

comment:3 Changed 4 years ago by Peter Suter

Milestone: 1.1.31.1.4

comment:4 Changed 4 years ago by Peter Suter

Replying to jomae in #11934:

  1. Unlike options in trac.ini, no way to known easily subscriber class's name. If the section is introduced, I think we should provide subscribers wiki page like TracIni and/or subscribers manager panel in admin page.

Good idea. Maybe TracIni#notification-subscriber-section could use a [[SubscriberList]] macro?

comment:5 in reply to:  4 Changed 4 years ago by Jun Omae

Replying to psuter:

Good idea. Maybe TracIni#notification-subscriber-section could use a [[SubscriberList]] macro?

Yeah. Sounds good.

comment:6 Changed 4 years ago by Peter Suter

Updated in changeset:T11875-notification-subrscriber-config-section-2/psuter.hg with a [[SubscriberList]] macro.

comment:7 Changed 4 years ago by Peter Suter

Milestone: 1.1.41.1.5

Looks like a bunch of tests need an update.

comment:8 Changed 4 years ago by Peter Suter

In log:psuter.hg@T11875_notification_subscriber_config_section_3:

  • Updated tests
  • Default settings: I assume for new environments [notification-subscriber] should have defaults equivalent to the previous [notification] always_notify_* defaults, mirroring the upgrade step. So far the only ConfigSection with default values seem to be [ticket-workflow] (which has a custom IEnvironmentSetupParticipant) and [repositories] (which has special handling in trac-admin initenv).
  • Invalidate cache: If the parsed subscriber configuration is cached, that cache must be invalidated, or configuration changes have no effect.

comment:9 Changed 4 years ago by Peter Suter

API Changes: modified (diff)
Release Notes: modified (diff)

comment:10 Changed 4 years ago by Peter Suter

Committed in [13933].

TracNotification may need an updated wiki:1.1/TracNotification now.

By the way, is there a guideline for using trac.util.lazy or trac.cache.cached?

comment:11 Changed 4 years ago by Peter Suter

Resolution: fixed
Status: assignedclosed

I added a short section in wiki:1.1/TracNotification@2. Feel free to improve it.

comment:12 Changed 4 years ago by Jun Omae

AlwaysEmailSubscriber cannot be configured using [notification-subscribers] section. I've filed in #12036.

comment:13 Changed 3 years ago by Ryan J Ollos

Unless I'm missing something, #2247 was implemented in this ticket. I've closed that ticket as a duplicate. We now have a Never Notify: I Update a Ticket preference, which I've been using for some time to avoid receiving notifications when I create or update a ticket.

Last edited 3 years ago by Ryan J Ollos (previous) (diff)

comment:14 Changed 22 months ago by skrattaren@…

Doesn't this feature seem underdocumented for you, guys? I'm trying to figure how to get from Trac 1.2 the same behaviour as from 1.0 with NeverNotifyUpdaterPlugin. I've dug into sources and still all I comprehend is a vague idea of "I probably have to implement Subscriber plugin to unsubscribe ticket updater". "Never Notify: I Update a Ticket preference" is nice, but asking all users to tinker with notification preferences manually instead of setting sensible defaults in trac.ini is suboptimal, don't you think? TracNotification includes [notification-subscribers] section twice, but it really does not make any clearer how to send notifications, let's say, for owner, reporter and all the updaters except current one.

Last edited 22 months ago by Ryan J Ollos (previous) (diff)

comment:15 Changed 22 months ago by Peter Suter

Some more documentation has been added in TracNotification@92.

Please ask further questions on the MailingList, thanks.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Peter Suter.
The resolution will be deleted.
to The owner will be changed from Peter Suter 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.