From: Kohei Yoshino Date: Tue, 19 Feb 2019 15:17:34 +0000 (-0500) Subject: Bug 1047539 - Bugmails including "See Also" bug links do not include a "Referenced... X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5cd912d709c2e016fb77fb6fa277ccc5760123b4;p=thirdparty%2Fbugzilla.git Bug 1047539 - Bugmails including "See Also" bug links do not include a "Referenced Bugs" section with the summary of the other bug --- diff --git a/Bugzilla/BugMail.pm b/Bugzilla/BugMail.pm index d5c1c4c95..47edac751 100644 --- a/Bugzilla/BugMail.pm +++ b/Bugzilla/BugMail.pm @@ -137,6 +137,7 @@ sub Send { if (!$start) { push @referenced_bugs, @{$bug->dependson}; push @referenced_bugs, @{$bug->blocked}; + push @referenced_bugs, _parse_see_also(map { $_->name } @{$bug->see_also}); } # If no changes have been made, there is no need to process further. @@ -599,6 +600,11 @@ sub _get_diffs { push @$referenced_bugs, grep {/^\d+$/} split(/[\s,]+/, $diff->{old}); push @$referenced_bugs, grep {/^\d+$/} split(/[\s,]+/, $diff->{new}); } + elsif ($diff->{field_name} eq 'see_also') { + foreach my $field ('new', 'old') { + push @$referenced_bugs, _parse_see_also(split(/[\s,]+/, $diff->{$field})); + } + } } return ($diffs, $referenced_bugs); @@ -665,4 +671,12 @@ sub _get_new_bugmail_fields { return @diffs; } +sub _parse_see_also { + my (@links) = @_; + my $urlbase = Bugzilla->localconfig->{urlbase}; + my $bug_link_re = qr/^\Q$urlbase\Eshow_bug\.cgi\?id=(\d+)$/; + + return grep { /^\d+$/ } map { /$bug_link_re/ ? int($1) : () } @links; +} + 1;