Modify

Opened 3 years ago

Last modified 13 months ago

#9048 new enhancement

[RFC][PATCH] Policer extension point, and improvement on user preference box programming

Reported by: bof Owned by: hasienda
Priority: normal Component: AnnouncerPlugin
Severity: normal Keywords:
Cc: rjollos Trac Release: 0.11

Description

This is a request for comments, and a moderately large patch
to serve as a foundation for the request.

The focus is on improvements to the user preference panels,
and especially on a new way to selectively remove subscribers,
before announcements are distributed, under various conditions.

My trac installation and development system is still running 0.11.7,
so I'm making these changes against the 0.11/ branch of AnnouncerPlugin,
in the hope that code did not diverge too much to make this useless.

I'll create this ticket with the patch attached, then write a comment
with more elaboration on the contained features.

I'm looking forward to any comments you might have, and directions
on how likely it is to get this integrated.

Attachments (3)

announcerplugin-policer-and-shared-prefs-boxes.patch (27.9 KB) - added by bof 3 years ago.
minimal updates
announcerplugin-policer-and-shared-prefs-boxes-V2.patch (32.1 KB) - added by bof 3 years ago.
respin - now with revert-user-settings-to-defaults functionality
policer-settings.png (30.7 KB) - added by bof 3 years ago.
teaser - this is how the policer settings box looks like now

Download all attachments as: .zip

Change History (6)

comment:1 Changed 3 years ago by bof

Ground covered:

IAnnouncementPolicer

A new extension point, IAnnouncementPolicer, is provided.
Implementors are called after the list of all subscriptions
has been built, and before the distributors are called.
Implementors can then remove subscribers from the list,
to suppress announcements to them by various criteria.

Interface and central implementation in api.py

The patch contains five exemplary implementations of policers. Some of them have
user preferences, all going into a single box in the preferences
panel.

To enable the policers, you have to put this in trac.ini:

[components]
announcerplugin.policer.* = enabled

Use the admin panel plugin configuration to selectively enable
or disable them.

The five policers in the patch provide the following functions,
each in a separate policer. All individual trac.ini options go to
the [announcer] section:

  • observe WIKI_VIEW or TICKET_VIEW permission, per subscriber. There is no trac.ini option (or user preference :) for this, just enabling or disabling of the policer module.


  • a replacement for the ignore_cc_changes option, previously found in producers/ticket.py - both with a backwards compatible trac.ini default, and user preference overriding of that.
    ignore_cc_changes = true
    


  • a reimplementation of my ignore_status_only patch (#9031), also providing user preferences overriding the trac.ini defaults
    ignore_status_only = true
    no_ignore_status = accepted, super_important_status
    
  • do not announce changes to the user that the user made herself (by user preference and trac.ini default) This is a replacement for the NeverNotifyUpdaterPlugin, which no longer works when you use AnnouncerPlugin.
    policer.never_notify_updater = true
    
  • completely disable announcements for the given user (by their preference) Might be useful when people go on holiday. Has no trac.ini default.

User Preference Boxes

While keeping the current preferences box interface, a similar, new
extension point IAnnouncementPreferenceSettingProvider can be used
to define, from several different implementors, settings that should
go into the same box.

Interface in api.py, implementation in pref.py

  • two helper functions, user_setting() and get_user_setting(), are provided in pref.py for use by any submodule that wants to retrieve or store user preferences. These helpers could be used by several of the existing modules, but this patch does not contain that.
  • A configuration method is provided to sort the boxes in the user preference panel, and to sort the settings in shared boxes as per the new IAnnouncementPreferenceSettingProvider interface.
    pref.order = email, legacy, policer_suppressions, emailaddress
    pref.order.policer_suppressions = never_notify_at_all, never_notify_updater
    
    If no configuration is made, boxes are sorted alphabetically by their box names. That approach provides a stable order of the boxes, regardless of plugin and extension point order, which seems to be quite shaky.

Changed 3 years ago by bof

minimal updates

Changed 3 years ago by bof

respin - now with revert-user-settings-to-defaults functionality

comment:2 Changed 3 years ago by bof

The -V2 patch moves the user setting helpers from pref.py to a new file userpref.py.

Functionality added: when user settings are present in the settings DB, i.e. system defaults from trac.ini are overridden, a new checkbox is rendered at the right margin of the settings box, which can be checked + on submit, the settings in that line will return to their trac.ini defaults, and are removed from the DB.

Calling sites (in policer/*.py) are also cleaned up a bit, with more compact helper function signatures.

The templates use a table now - is there a better way to optionally add a right-floating checkbox that keeps vertical alignment with the settings it stands for?

Changed 3 years ago by bof

teaser - this is how the policer settings box looks like now

comment:3 Changed 13 months ago by hasienda

  • Owner changed from doki_pen to hasienda

Add Comment

Modify Ticket

Action
as new .
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.