]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 509035: An empty e-mail gets sent to non-timetrackinggroup members if I change...
authorlpsolit%gmail.com <>
Tue, 8 Sep 2009 16:12:31 +0000 (16:12 +0000)
committerlpsolit%gmail.com <>
Tue, 8 Sep 2009 16:12:31 +0000 (16:12 +0000)
Bugzilla/BugMail.pm

index bea36e8660f6197a037dcb80678aa7fb5cb8b57d..5bbbe723a8ec3cff9dc5564d421604601e675e03 100644 (file)
@@ -576,22 +576,11 @@ sub sendMail {
             $difftext .= $diff->{'text'};
         }
     }
-    if ($difftext eq "" && $newcomments eq "" && !$isnew) {
+
+    if ($difftext eq "" && !scalar(@$newcomments) && !$isnew) {
       # Whoops, no differences!
       return 0;
     }
-    
-    # If an attachment was created, then add an URL. (Note: the 'g'lobal
-    # replace should work with comments with multiple attachments.)
-
-    if ( $newcomments =~ /Created an attachment \(/ ) {
-
-        my $showattachurlbase =
-            Bugzilla->params->{'urlbase'} . "attachment.cgi?id=";
-
-        $newcomments =~ s/(Created an attachment \(id=([0-9]+)\))/$1\n --> \(${showattachurlbase}$2\)/g;
-    }
 
     my $diffs = $difftext;
     # Remove extra newlines.
@@ -686,9 +675,15 @@ sub get_comments_by_bug {
 
     my $raw = 1; # Do not format comments which are not of type CMT_NORMAL.
     my $comments = Bugzilla::Bug::GetComments($id, "oldest_to_newest", $start, $end, $raw);
+    my $attach_base = correct_urlbase() . 'attachment.cgi?id=';
 
     foreach my $comment (@$comments) {
         $comment->{count} = $count++;
+        # If an attachment was created, then add an URL. (Note: the 'g'lobal
+        # replace should work with comments with multiple attachments.)
+        if ($comment->{body} =~ /Created an attachment \(/) {
+            $comment->{body} =~ s/(Created an attachment \(id=([0-9]+)\))/$1\n --> \($attach_base$2\)/g;
+        }
     }
 
     if (Bugzilla->params->{'insidergroup'}) {