Edgewall Software

Opened 5 years ago

Last modified 3 years ago

#12808 closed enhancement

Allow permission groups to be CC'ed — at Initial Version

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


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']))
     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])
    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.

Change History (1)

by Ryan J Ollos, 5 years ago

Note: See TracTickets for help on using tickets.