From a7196a73cec5af3aa91f0af93d6316df1db7f433 Mon Sep 17 00:00:00 2001 From: Max Kanat-Alexander Date: Thu, 11 Feb 2010 12:32:08 -0800 Subject: Bug 545715: New Hook: bugmail_relationships r=mkanat, a=mkanat (module owner) --- extensions/Example/Extension.pm | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'extensions') diff --git a/extensions/Example/Extension.pm b/extensions/Example/Extension.pm index fd75cbf64..6acf3e135 100644 --- a/extensions/Example/Extension.pm +++ b/extensions/Example/Extension.pm @@ -36,6 +36,9 @@ use Bugzilla::Extension::Example::Util; use Data::Dumper; +# See bugmail_relationships. +use constant REL_EXAMPLE => -127; + our $VERSION = '1.0'; sub attachment_process_data { @@ -193,14 +196,28 @@ sub bugmail_recipients { my ($self, $args) = @_; my $recipients = $args->{recipients}; my $bug = $args->{bug}; + + my $user = + new Bugzilla::User({ name => Bugzilla->params->{'maintainer'} }); + if ($bug->id == 1) { - # Uncomment the line below to add the second user in the Bugzilla - # database to the recipients list of every bugmail sent out about - # bug 1 as though that user were on the CC list. - #$recipients->{2}->{+REL_CC} = 1; + # Uncomment the line below to add the maintainer to the recipients + # list of every bugmail from bug 1 as though that the maintainer + # were on the CC list. + #$recipients->{$user->id}->{+REL_CC} = 1; + + # And this line adds the maintainer as though he had the "REL_EXAMPLE" + # relationship from the bugmail_relationships hook below. + #$recipients->{$user->id}->{+REL_EXAMPLE} = 1; } } +sub bugmail_relationships { + my ($self, $args) = @_; + my $relationships = $args->{relationships}; + $relationships->{+REL_EXAMPLE} = 'Example'; +} + sub colchange_columns { my ($self, $args) = @_; -- cgit v1.2.3-24-g4f1b