Edgewall Software

Opened 7 years ago

Last modified 5 years ago

#12808 closed enhancement

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

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:
Internal 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.

Change History (7)

by Ryan J Ollos, 7 years ago

comment:1 by Ryan J Ollos, 7 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, 7 years ago

Milestone: 1.3.2next-dev-1.3.x

comment:3 by Ryan J Ollos, 5 years 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, 5 years ago

Status: assignednew

comment:5 by Ryan J Ollos, 5 years ago

Owner: set to Ryan J Ollos
Status: newassigned

comment:6 by Ryan J Ollos, 5 years ago

Release Notes: modified (diff)

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

Note: See TracTickets for help on using tickets.