On Tuesday, May 9, 2017 at 1:51:58 PM UTC-7, Peter Suter wrote:
>
> On 09.05.2017 22:13, toto200891 wrote:
>
> Hi
>
> Could anybody suggest some ideas about group notification? what I mean is
> like if there are 3 groups A, B and C and every group have different members
> with different mail id's. And now if I have to notify a particular group, say
> for example Group A? How could I do it?
>
> For now I am entering email id of each member manually. Is there any other
> way to send an email to every member of that group by writing a single mail
> id? I have also tried creating a gmail group and tried sending it to that
> group. But as you know the mail get delivered to the group and not to the
> inbox of the members?
>
> So could you please suggest some ideas to achieve the following objective.
>
> Regards
> SF
>
>
> Hi
>
> You could test JoinableGroupSubscriber:
> https://trac.edgewall.org/ticket/11870#comment:3
>
> https://trac.edgewall.org/browser/psuter.hg/tracopt/notification/joinable_groups.py?rev=10397
> https://trac.edgewall.org/attachment/ticket/11870/watch-prefs.png
>
> Regards,
> Peter
>
I can also see how it would be desirable to CC a permission group, and have
all members of the group receive an email. Without accounting for
overlapping user and group name,s here is a simple patch to demonstrate
(against 1.2-stable):
diff --git a/trac/ticket/notification.py b/trac/ticket/notification.py
index 92957d016..589fdbb41 100644
--- a/trac/ticket/notification.py
+++ b/trac/ticket/notification.py
@@ -29,6 +29,7 @@ from trac.notification.compat import NotifyEmail
from trac.notification.mail import (RecipientMatcher, create_message_id,
get_from_author, set_header)
from trac.notification.model import Subscription
+from trac.perm import PermissionSystem
from trac.ticket.api import translation_deactivated
from trac.ticket.model import Ticket
from trac.util.datefmt import (datetime_now, format_date_or_datetime,
@@ -462,6 +463,13 @@ class CarbonCopySubscriber(Component):
if 'fields' in event.changes and 'cc' in event.changes['fields']:
cc_set.update(to_set(event.changes['fields']['cc']['old']))
+ # Get members of permission groups
+ groups = PermissionSystem(self.env).get_groups_dict()
+ for cc in cc_set.copy():
+ if cc in groups:
+ cc_set.remove(cc)
+ cc_set.update(groups[cc])
+
matcher = RecipientMatcher(self.env)
klass = self.__class__.__name__
sids = set()
If we don't want this to be the default behavior, we could use similar
logic to create a CarbonCopyGroupSubscriber. In the case of a group that
has the same name as an sid, we'd have to decide which takes precedent, and
should log a warning. As far as I'm concerned, CarbonCopyGroupSubscriber
could just go in trac.ticket.notification rather than tracopt.notification,
since it wouldn't be enabled by default anyway.
- Ryan
--
You received this message because you are subscribed to the Google Groups "Trac
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.