Modify

Opened 7 years ago

Last modified 7 years ago

#13117 new enhancement

Use INotificationSubscriber rather than EmailDistributor disabled

Reported by: Jun Omae Owned by:
Priority: normal Component: QuietPlugin
Severity: normal Keywords:
Cc: Trac Release: 1.2

Description

QuietPlugin requires EmailDistributor disabled and QuietEmailDistributor enabled. However, I don't think that is good to implement quiet-mode.

Instead, we could implement subscriber which returns -1 as priority and 'never' as adverb for users in quiet mode.

quiet-subscriber.diff

Attachments (1)

quiet-subscriber.diff (3.0 KB) - added by Jun Omae 7 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 Changed 7 years ago by Ryan J Ollos

I had wondered if there might be a better way (comment:9:ticket:13045). Feel free to commit a patch. I gave you owner permissions on PyPI so you can publish an updated package.

TODO Revise QuietPlugin#Installation if patch is committed.

Changed 7 years ago by Jun Omae

Attachment: quiet-subscriber.diff added

comment:2 Changed 7 years ago by Jun Omae

I thought that is an easy task but actually not. Proposed changes is incomplete. If email address is set to Cc field and smtp_always_{cc,bcc} options, the notifications couldn't be blocked.

It is caused by NotificationSystem.subscriptions() determines always for email addresses at source:/tags/trac-1.2/trac/notification/api.py@:412-414#L382.

BTW, I noticed 2 issues while implementing it.

  1. _is_quiet_mode() should check session_attribute.authenticated=1.
  2. If QUIET_MODE is revoked from a user after setting quiet-mode, changes from the user are still quiet.

comment:3 in reply to:  2 Changed 7 years ago by Ryan J Ollos

Replying to Jun Omae:

BTW, I noticed 2 issues while implementing it.

  1. _is_quiet_mode() should check session_attribute.authenticated=1.
  2. If QUIET_MODE is revoked from a user after setting quiet-mode, changes from the user are still quiet.

Thanks, I'll commit those changes.

comment:4 Changed 7 years ago by Ryan J Ollos

In 16352:

1.2.1dev: Check QUIET_MODE when distributing email

Also, use authenticated flag when checking quiet mode because
event.author is never a session id, so quiet mode will only
work for authenticated users.

Patch by Jun Omae.

Refs #13117.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The ticket will remain with no owner.

Add Comment


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

 
Note: See TracTickets for help on using tickets.