]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 643910: Email notifications from a blocked bug have the timestamp from its last...
authorFrédéric Buclin <LpSolit@gmail.com>
Wed, 27 Apr 2011 21:47:50 +0000 (23:47 +0200)
committerFrédéric Buclin <LpSolit@gmail.com>
Wed, 27 Apr 2011 21:47:50 +0000 (23:47 +0200)
r=dkl a=LpSolit

Bugzilla/Bug.pm
Bugzilla/BugMail.pm

index ceb773aec7f8741d0d35c386c22d89cda8a83dc1..273883cf6527eeefdf42c40d554d0ba16649e3b2 100644 (file)
@@ -1160,14 +1160,20 @@ sub send_changes {
 
     # If there were changes in dependencies, we need to notify those
     # dependencies.
-    my %notify_deps;
     if ($changes->{'bug_status'}) {
         my ($old_status, $new_status) = @{ $changes->{'bug_status'} };
 
         # If this bug has changed from opened to closed or vice-versa,
         # then all of the bugs we block need to be notified.
         if (is_open_state($old_status) ne is_open_state($new_status)) {
-            $notify_deps{$_} = 1 foreach (@{ $self->blocked });
+            my $params = { forced   => { changer => $user },
+                           type     => 'dep',
+                           dep_only => 1 };
+
+            foreach my $id (@{ $self->blocked }) {
+                $params->{id} = $id;
+                _send_bugmail($params, $vars);
+            }
         }
     }
 
@@ -1183,8 +1189,7 @@ sub send_changes {
     # an error later.
     delete $changed_deps{''};
 
-    my %all_dep_changes = (%notify_deps, %changed_deps);
-    foreach my $id (sort { $a <=> $b } (keys %all_dep_changes)) {
+    foreach my $id (sort { $a <=> $b } (keys %changed_deps)) {
         _send_bugmail({ forced => { changer => $user }, type => "dep",
                          id => $id }, $vars);
     }
@@ -1194,7 +1199,7 @@ sub _send_bugmail {
     my ($params, $vars) = @_;
 
     my $results = 
-        Bugzilla::BugMail::Send($params->{'id'}, $params->{'forced'});
+        Bugzilla::BugMail::Send($params->{'id'}, $params->{'forced'}, $params);
 
     if (Bugzilla->usage_mode == USAGE_MODE_BROWSER) {
         my $template = Bugzilla->template;
index e585fb7afaa21e322045cac9036414f661666816..2f3478dc8b88f2e9d676cb37e19e1af1c8ee96cf 100644 (file)
@@ -109,7 +109,8 @@ sub relationships {
 # All the names are email addresses, not userids
 # values are scalars, except for cc, which is a list
 sub Send {
-    my ($id, $forced) = (@_);
+    my ($id, $forced, $params) = (@_);
+    $params ||= {};
 
     my $dbh = Bugzilla->dbh;
     my $bug = new Bugzilla::Bug($id);
@@ -379,7 +380,8 @@ sub Send {
 
     # The email client will display the Date: header in the desired timezone,
     # so we can always use UTC here.
-    my $date = format_time($bug->delta_ts, '%a, %d %b %Y %T %z', 'UTC');
+    my $date = $params->{dep_only} ? $end : $bug->delta_ts;
+    $date = format_time($date, '%a, %d %b %Y %T %z', 'UTC');
 
     foreach my $user_id (keys %recipients) {
         my %rels_which_want;