summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Mailer.pm
diff options
context:
space:
mode:
authordkl%redhat.com <>2008-08-28 03:38:45 +0200
committerdkl%redhat.com <>2008-08-28 03:38:45 +0200
commitef56c491a65eed9dfddb2866c5faa59acb69b0ed (patch)
treec19810a3e76fae26301ce030f5e9412e564fcee7 /Bugzilla/Mailer.pm
parent745f9e658a8e4d26bfd250b263132b25ab60e173 (diff)
downloadbugzilla-ef56c491a65eed9dfddb2866c5faa59acb69b0ed.tar.gz
bugzilla-ef56c491a65eed9dfddb2866c5faa59acb69b0ed.tar.xz
Bug 449791 – Allow flag notification emails to be threaded similar to normal bug change emails
Patch by Dave Lawrence <dkl@redhat.com> - r/a=LpSolit
Diffstat (limited to 'Bugzilla/Mailer.pm')
-rw-r--r--Bugzilla/Mailer.pm29
1 files changed, 28 insertions, 1 deletions
diff --git a/Bugzilla/Mailer.pm b/Bugzilla/Mailer.pm
index 5c7a75450..c790d179f 100644
--- a/Bugzilla/Mailer.pm
+++ b/Bugzilla/Mailer.pm
@@ -35,7 +35,7 @@ package Bugzilla::Mailer;
use strict;
use base qw(Exporter);
-@Bugzilla::Mailer::EXPORT = qw(MessageToMTA);
+@Bugzilla::Mailer::EXPORT = qw(MessageToMTA build_thread_marker);
use Bugzilla::Constants;
use Bugzilla::Error;
@@ -154,4 +154,31 @@ sub MessageToMTA {
}
}
+# Builds header suitable for use as a threading marker in email notifications
+sub build_thread_marker {
+ my ($bug_id, $user_id, $is_new) = @_;
+
+ if (!defined $user_id) {
+ $user_id = Bugzilla->user->id;
+ }
+
+ my $sitespec = '@' . Bugzilla->params->{'urlbase'};
+ $sitespec =~ s/:\/\//\./; # Make the protocol look like part of the domain
+ $sitespec =~ s/^([^:\/]+):(\d+)/$1/; # Remove a port number, to relocate
+ if ($2) {
+ $sitespec = "-$2$sitespec"; # Put the port number back in, before the '@'
+ }
+
+ my $threadingmarker;
+ if ($is_new) {
+ $threadingmarker = "Message-ID: <bug-$bug_id-$user_id$sitespec>";
+ }
+ else {
+ $threadingmarker = "In-Reply-To: <bug-$bug_id-$user_id$sitespec>" .
+ "\nReferences: <bug-$bug_id-$user_id$sitespec>";
+ }
+
+ return $threadingmarker;
+}
+
1;