From 2803e4edc8fb3e8a3d92ca5a995e09d1fecfe9bb Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" Date: Fri, 7 Jan 2011 11:16:39 +0000 Subject: [PATCH] Provide user objects to bugmail_recipients hook. r,a=mkanat. git-svn-id: svn://10.0.0.236/trunk@261727 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/webtools/bugzilla/.bzrrev | 2 +- mozilla/webtools/bugzilla/Bugzilla/BugMail.pm | 8 +++++++- mozilla/webtools/bugzilla/Bugzilla/Hook.pm | 8 ++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/mozilla/webtools/bugzilla/.bzrrev b/mozilla/webtools/bugzilla/.bzrrev index eb32046b70e..96143871638 100644 --- a/mozilla/webtools/bugzilla/.bzrrev +++ b/mozilla/webtools/bugzilla/.bzrrev @@ -1 +1 @@ -7647 \ No newline at end of file +7648 \ No newline at end of file diff --git a/mozilla/webtools/bugzilla/Bugzilla/BugMail.pm b/mozilla/webtools/bugzilla/Bugzilla/BugMail.pm index dfd7584ea63..048488e02ee 100644 --- a/mozilla/webtools/bugzilla/Bugzilla/BugMail.pm +++ b/mozilla/webtools/bugzilla/Bugzilla/BugMail.pm @@ -184,8 +184,14 @@ sub Send { } } + # Make sure %user_cache has every user in it so far referenced + foreach my $user_id (keys %recipients) { + $user_cache{$user_id} ||= new Bugzilla::User($user_id); + } + Bugzilla::Hook::process('bugmail_recipients', - { bug => $bug, recipients => \%recipients }); + { bug => $bug, recipients => \%recipients, + users => \%user_cache }); # Find all those user-watching anyone on the current list, who is not # on it already themselves. diff --git a/mozilla/webtools/bugzilla/Bugzilla/Hook.pm b/mozilla/webtools/bugzilla/Bugzilla/Hook.pm index b48ebb9faa7..1b4bdd97199 100644 --- a/mozilla/webtools/bugzilla/Bugzilla/Hook.pm +++ b/mozilla/webtools/bugzilla/Bugzilla/Hook.pm @@ -494,6 +494,14 @@ as though he were on the CC list: (We use C<+> in front of C so that Perl interprets it as a constant instead of as a string.) +=item C + +This is a hash of L objects, keyed by id. This is so you can +find out more information about any of the user ids in the C hash. +Every id in the incoming C hash will have an object in here. +(But if you add additional recipients to the C hash, you are +B required to add them to this hash.) + =back