diff options
author | lpsolit%gmail.com <> | 2006-12-12 03:00:46 +0100 |
---|---|---|
committer | lpsolit%gmail.com <> | 2006-12-12 03:00:46 +0100 |
commit | 32f3ff65a8019fded30601f59f37306312576547 (patch) | |
tree | 3a5a3df17a0f49ab2b4dc32906238eaeb02eafbf /Bugzilla/Bug.pm | |
parent | 36540893adb1efd1a1fce5f2e115754f93442ca5 (diff) | |
download | bugzilla-32f3ff65a8019fded30601f59f37306312576547.tar.gz bugzilla-32f3ff65a8019fded30601f59f37306312576547.tar.xz |
Bug 297186: Send emails in the recipient's locale, not the current user's - Patch by Frédéric Buclin <LpSolit@gmail.com> r=bkor a=justdave
Diffstat (limited to 'Bugzilla/Bug.pm')
-rwxr-xr-x | Bugzilla/Bug.pm | 46 |
1 files changed, 30 insertions, 16 deletions
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 { |