Edgewall Software
Modify

Opened 3 years ago

Closed 4 months ago

Last modified 4 months ago

#12808 closed enhancement (fixed)

Allow permission groups to be CC'ed

Reported by: Ryan J Ollos Owned by: Ryan J Ollos
Priority: normal Milestone: 1.3.6
Component: notification Version:
Severity: normal Keywords: subscriber group
Cc: Branch:
Release Notes:

Permission groups in the CC list are resolved to the users that are members of the group.

API Changes:

Description

Discussed in trac-users:Aly_eHLw7J0/GmzimnwjAAAJ. It would be useful to allow permission groups to be CC'ed, at the very least to improvise until we have a real user and group system in Trac.

  • trac/ticket/notification.py

    diff --git a/trac/ticket/notification.py b/trac/ticket/notification.py
    index 92957d016..589fdbb41 100644
    a b from trac.notification.compat import NotifyEmail  
    2929from trac.notification.mail import (RecipientMatcher, create_message_id,
    3030                                    get_from_author, set_header)
    3131from trac.notification.model import Subscription
     32from trac.perm import PermissionSystem
    3233from trac.ticket.api import translation_deactivated
    3334from trac.ticket.model import Ticket
    3435from trac.util.datefmt import (datetime_now, format_date_or_datetime,
    class CarbonCopySubscriber(Component):  
    462463        if 'fields' in event.changes and 'cc' in event.changes['fields']:
    463464            cc_set.update(to_set(event.changes['fields']['cc']['old']))
    464465
     466        # Get members of permission groups
     467        groups = PermissionSystem(self.env).get_groups_dict()
     468        for cc in cc_set.copy():
     469            if cc in groups:
     470                cc_set.remove(cc)
     471                cc_set.update(groups[cc])
     472
    465473        matcher = RecipientMatcher(self.env)
    466474        klass = self.__class__.__name__
    467475        sids = set()

I don't see much downside to the patch provided that we don't intend to adopt a naming convention for groups later on, which could result in backward incompatible changes.

Attachments (1)

CarbonCopyGroupSubscriber.py (2.6 KB ) - added by Ryan J Ollos 3 years ago.

Download all attachments as: .zip

Change History (9)

by Ryan J Ollos, 3 years ago

comment:1 by Ryan J Ollos, 3 years ago

CarbonCopyGroupSubscriber.py implements notifications for permission group, for anyone needing an immediate solution. You can make it a default rule:

[notification-subscriber]
always_noticy_group_cc = CarbonCopyGroupSubscriber

Please ask on the MailingList, not here, if you have trouble with this single-file plugin.

comment:2 by Ryan J Ollos, 3 years ago

Milestone: 1.3.2next-dev-1.3.x

comment:3 by Ryan J Ollos, 4 months ago

Milestone: next-dev-1.3.x1.3.6
Type: defectenhancement

I'd like to consider this patch for 1.3.6.

comment:4 by Ryan J Ollos, 4 months ago

Status: assignednew

comment:5 by Ryan J Ollos, 4 months ago

Owner: set to Ryan J Ollos
Status: newassigned

comment:6 by Ryan J Ollos, 4 months ago

Release Notes: modified (diff)

Proposed changes in [3b6201f06/rjollos.git].

comment:7 by Ryan J Ollos, 4 months ago

Resolution: fixed
Status: assignedclosed

Committed to trunk in r17046.

comment:8 by Ryan J Ollos, 4 months ago

Documented in 1.3/TracNotification@5.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.
to as closed The owner will be changed from Ryan J Ollos 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.