From 32f3ff65a8019fded30601f59f37306312576547 Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Tue, 12 Dec 2006 02:00:46 +0000 Subject: Bug 297186: Send emails in the recipient's locale, not the current user's - Patch by Frédéric Buclin r=bkor a=justdave MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bugzilla/Bug.pm | 46 ++++++++++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 16 deletions(-) (limited to 'Bugzilla/Bug.pm') diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index f09386a0c..469b6ff60 100755 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -1405,7 +1405,7 @@ sub ValidateTime { } sub GetComments { - my ($id, $comment_sort_order, $start, $end) = @_; + my ($id, $comment_sort_order, $start, $end, $raw) = @_; my $dbh = Bugzilla->dbh; $comment_sort_order = $comment_sort_order || @@ -1438,21 +1438,9 @@ sub GetComments { $comment{'email'} .= Bugzilla->params->{'emailsuffix'}; $comment{'name'} = $comment{'name'} || $comment{'email'}; - if ($comment{'type'} == CMT_DUPE_OF) { - $comment{'body'} .= "\n\n" . get_text('bug_duplicate_of', - { dupe_of => $comment{'extra_data'} }); - } - elsif ($comment{'type'} == CMT_HAS_DUPE) { - $comment{'body'} = get_text('bug_has_duplicate', - { dupe => $comment{'extra_data'} }); - } - elsif ($comment{'type'} == CMT_POPULAR_VOTES) { - $comment{'body'} = get_text('bug_confirmed_by_votes'); - } - elsif ($comment{'type'} == CMT_MOVED_TO) { - $comment{'body'} .= "\n\n" . get_text('bug_moved_to', - { login => $comment{'extra_data'} }); - } + + # If raw data is requested, do not format 'special' comments. + $comment{'body'} = format_comment(\%comment) unless $raw; push (@comments, \%comment); } @@ -1464,6 +1452,32 @@ sub GetComments { return \@comments; } +# Format language specific comments. This routine must not update +# $comment{'body'} itself, see BugMail::prepare_comments(). +sub format_comment { + my $comment = shift; + my $body; + + if ($comment->{'type'} == CMT_DUPE_OF) { + $body = $comment->{'body'} . "\n\n" . + get_text('bug_duplicate_of', { dupe_of => $comment->{'extra_data'} }); + } + elsif ($comment->{'type'} == CMT_HAS_DUPE) { + $body = get_text('bug_has_duplicate', { dupe => $comment->{'extra_data'} }); + } + elsif ($comment->{'type'} == CMT_POPULAR_VOTES) { + $body = get_text('bug_confirmed_by_votes'); + } + elsif ($comment->{'type'} == CMT_MOVED_TO) { + $body = $comment->{'body'} . "\n\n" . + get_text('bug_moved_to', { login => $comment->{'extra_data'} }); + } + else { + $body = $comment->{'body'}; + } + return $body; +} + # Get the activity of a bug, starting from $starttime (if given). # This routine assumes ValidateBugID has been previously called. sub GetBugActivity { -- cgit v1.2.3-24-g4f1b