Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
5a10ebe6
Commit
5a10ebe6
authored
Jun 02, 2009
by
wurblzap%gmail.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 457657 â Make e-mail comment header localizable.
Patch by Marc Schumann <wurblzap@gmail.com>, r/a=LpSolit
parent
a778b485
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
86 additions
and
77 deletions
+86
-77
Bug.pm
Bugzilla/Bug.pm
+5
-19
BugMail.pm
Bugzilla/BugMail.pm
+10
-38
User.pm
Bugzilla/User.pm
+4
-3
format_comment.txt.tmpl
template/en/default/bug/format_comment.txt.tmpl
+61
-0
newchangedmail.txt.tmpl
template/en/default/email/newchangedmail.txt.tmpl
+6
-1
messages.html.tmpl
template/en/default/global/messages.html.tmpl
+0
-16
No files found.
Bugzilla/Bug.pm
View file @
5a10ebe6
...
...
@@ -3060,29 +3060,15 @@ sub GetComments {
return
\
@comments
;
}
# Format language specific comments. This routine must not update
# $comment{'body'} itself, see BugMail::prepare_comments().
# Format language specific comments.
sub
format_comment
{
my
$comment
=
shift
;
my
$template
=
Bugzilla
->
template_inner
;
my
$vars
=
{
comment
=>
$comment
};
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'
};
}
$template
->
process
(
"bug/format_comment.txt.tmpl"
,
$vars
,
\
$body
)
||
ThrowTemplateError
(
$template
->
error
());
return
$body
;
}
...
...
Bugzilla/BugMail.pm
View file @
5a10ebe6
...
...
@@ -357,7 +357,7 @@ sub Send {
}
}
my
(
$
raw_comments
,
$anyprivate
,
$count
)
=
get_comments_by_bug
(
$id
,
$start
,
$end
);
my
(
$
comments
,
$anyprivate
)
=
get_comments_by_bug
(
$id
,
$start
,
$end
);
###########################################################################
# Start of email filtering code
...
...
@@ -450,9 +450,6 @@ sub Send {
my
@sent
;
my
@excluded
;
# Some comments are language specific. We cache them here.
my
%
comments
;
foreach
my
$user_id
(
keys
%
recipients
)
{
my
%
rels_which_want
;
my
$sent_mail
=
0
;
...
...
@@ -461,24 +458,14 @@ sub Send {
# Deleted users must be excluded.
next
unless
$user
;
# What's the language chosen by this user for email?
my
$lang
=
$user
->
settings
->
{
'lang'
}
->
{
'value'
};
if
(
$user
->
can_see_bug
(
$id
))
{
# It's time to format language specific comments.
unless
(
exists
$comments
{
$lang
})
{
Bugzilla
->
template_inner
(
$lang
);
$comments
{
$lang
}
=
prepare_comments
(
$raw_comments
,
$count
);
Bugzilla
->
template_inner
(
""
);
}
# Go through each role the user has and see if they want mail in
# that role.
foreach
my
$relationship
(
keys
%
{
$recipients
{
$user_id
}})
{
if
(
$user
->
wants_bug_mail
(
$id
,
$relationship
,
$diffs
,
$comments
{
$lang
}
,
$comments
,
$deptext
,
$changer
,
!
$start
))
...
...
@@ -524,7 +511,7 @@ sub Send {
\%
defmailhead
,
\%
fielddescription
,
\
@diffparts
,
$comments
{
$lang
}
,
$comments
,
$anyprivate
,
!
$start
,
$id
,
...
...
@@ -607,7 +594,7 @@ sub sendMail {
$newcomments
=~
s/(Created an attachment \(id=([0-9]+)\))/$1\n --> \(${showattachurlbase}$2\)/g
;
}
my
$diffs
=
$difftext
.
"\n\n"
.
$newcomments
;
my
$diffs
=
$difftext
;
if
(
$isnew
)
{
my
$head
=
""
;
foreach
my
$f
(
@headerlist
)
{
...
...
@@ -663,6 +650,7 @@ sub sendMail {
reporter
=>
$values
{
'reporter'
},
reportername
=>
Bugzilla::
User
->
new
({
name
=>
$values
{
'reporter'
}})
->
name
,
diffs
=>
$diffs
,
new_comments
=>
$newcomments
,
threadingmarker
=>
build_thread_marker
(
$id
,
$user
->
id
,
$isnew
),
};
...
...
@@ -698,31 +686,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
);
foreach
my
$comment
(
@$comments
)
{
$comment
->
{
count
}
=
$count
++
;
}
if
(
Bugzilla
->
params
->
{
'insidergroup'
})
{
$anyprivate
=
1
if
scalar
(
grep
{
$_
->
{
'isprivate'
}
>
0
}
@$comments
);
}
return
(
$comments
,
$anyprivate
,
$count
);
}
# Prepare comments for the given language.
sub
prepare_comments
{
my
(
$raw_comments
,
$count
)
=
@_
;
my
$result
=
""
;
foreach
my
$comment
(
@$raw_comments
)
{
if
(
$count
)
{
$result
.=
"\n\n--- Comment #$count from "
.
$comment
->
{
'author'
}
->
identity
.
" "
.
format_time
(
$comment
->
{
'time'
})
.
" ---\n"
;
}
# Format language specific comments. We don't update $comment->{'body'}
# directly, otherwise it would grow everytime you call format_comment()
# with a different language as some text may be appended to the existing one.
my
$body
=
Bugzilla::Bug::
format_comment
(
$comment
);
$result
.=
(
$comment
->
{
'already_wrapped'
}
?
$body
:
wrap_comment
(
$body
));
$count
++
;
}
return
$result
;
return
(
$comments
,
$anyprivate
);
}
1
;
Bugzilla/User.pm
View file @
5a10ebe6
...
...
@@ -1372,8 +1372,9 @@ our %names_to_events = (
# Note: the "+" signs before the constants suppress bareword quoting.
sub
wants_bug_mail
{
my
$self
=
shift
;
my
(
$bug_id
,
$relationship
,
$fieldDiffs
,
$comment
Field
,
$dependencyText
,
my
(
$bug_id
,
$relationship
,
$fieldDiffs
,
$comment
s
,
$dependencyText
,
$changer
,
$bug_is_new
)
=
@_
;
my
$comments_concatenated
=
join
(
"\n"
,
map
{
$_
->
{
body
}
}
(
@$comments
));
# Make a list of the events which have happened during this bug change,
# from the point of view of this user.
...
...
@@ -1422,10 +1423,10 @@ sub wants_bug_mail {
}
}
if
(
$comment
Fiel
d
=~
/Created an attachment \(/
)
{
if
(
$comment
s_concatenate
d
=~
/Created an attachment \(/
)
{
$events
{
+
EVT_ATTACHMENT
}
=
1
;
}
elsif
(
$commentField
ne
''
)
{
elsif
(
defined
(
$$comments
[
0
])
)
{
$events
{
+
EVT_COMMENT
}
=
1
;
}
...
...
template/en/default/bug/format_comment.txt.tmpl
0 → 100755
View file @
5a10ebe6
[%# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is the Bugzilla Bug Tracking System.
#
# The Initial Developer of the Original Code is Marc Schumann.
# Portions created by Marc Schumann are Copyright (c) 2008 Marc Schumann.
# All rights reserved.
#
# Contributor(s): Marc Schumann <wurblzap@gmail.com>
#%]
[%# INTERFACE:
# comment: A hash containing comment information.
# count: The comment number (on the bug it belongs to)
# author: The Bugzilla::User object of the comment's
# author
# time: The time at which the comment has been
# committed
# body: The comment text
# type: One of the CMT_* constants (not given if none
# applies)
# extra_data: Extra data (type specific)
# already_wrapped: Determines whether the comment is pre-wrapped
#%]
[% PROCESS 'global/field-descs.none.tmpl' %]
[% IF comment.already_wrapped %]
[% wrapped_comment = comment.body %]
[% ELSE %]
[% wrapped_comment = comment.body FILTER wrap_comment %]
[% END %]
[%- IF comment.type == constants.CMT_DUPE_OF -%]
[% wrapped_comment %]
*** This [% terms.bug %] has been marked as a duplicate of [% terms.bug %] [%+ comment.extra_data %] ***
[% ELSIF comment.type == constants.CMT_HAS_DUPE %]
*** [% terms.Bug %] [%+ comment.extra_data %] has been marked as a duplicate of this [% terms.bug %]. ***
[% ELSIF comment.type == constants.CMT_POPULAR_VOTES %]
*** This [% terms.bug %] has been confirmed by popular vote. ***
[% ELSIF comment.type == constants.CMT_MOVED_TO %]
[% wrapped_comment %]
[%+ terms.Bug %] moved to [% Param("move-to-url") %].
If the move succeeded, [% comment.extra_data %] will receive a mail containing
the number of the new [% terms.bug %] in the other database.
If all went well, please mark this [% terms.bug %]
[%+ get_status('VERIFIED') %], and paste in a link to the new [% terms.bug %].
Otherwise, reopen this [% terms.bug %].
[%- ELSE -%]
[%- wrapped_comment %]
[% END %]
template/en/default/email/newchangedmail.txt.tmpl
View file @
5a10ebe6
...
...
@@ -43,8 +43,13 @@ X-Bugzilla-Changed-Fields: [% changedfields %]
[%+ urlbase %]show_bug.cgi?id=[% bugid %]
[%+ diffs %]
[% FOREACH comment = new_comments %]
--
--- Comment #[% comment.count %] from [% comment.author.identity %] [%+ comment.time FILTER time %] ---
[%+ PROCESS bug/format_comment.txt.tmpl comment = comment %]
[% END %]
-- [%# Protect the trailing space of the signature marker %]
Configure [% terms.bug %]mail: [% urlbase %]userprefs.cgi?tab=email
------- You are receiving this mail because: -------
[% FOREACH relationship = reasons %]
...
...
template/en/default/global/messages.html.tmpl
View file @
5a10ebe6
...
...
@@ -124,25 +124,9 @@
Please add your attachment by clicking the "Add an Attachment" link
below.
[% ELSIF message_tag == "bug_confirmed_by_votes" %]
*** This [% terms.bug %] has been confirmed by popular vote. ***
[% ELSIF message_tag == "bug_duplicate_of" %]
*** This [% terms.bug %] has been marked as a duplicate of [% terms.bug %] [%+ dupe_of FILTER html %] ***
[% ELSIF message_tag == "bug_has_duplicate" %]
*** [% terms.Bug %] [%+ dupe FILTER html %] has been marked as a duplicate of this [% terms.bug %]. ***
[% ELSIF message_tag == "bug_group_description" %]
Access to [% terms.bugs %] in the [% product.name FILTER html %] product
[% ELSIF message_tag == "bug_moved_to" %]
<p>[% terms.Bug %] moved to [% Param("move-to-url") FILTER html %].</p>
<p>If the move succeeded, [% login FILTER html %] will receive a mail
containing the number of the new [% terms.bug %] in the other database.
If all went well, please mark this [% terms.bug %] verified, and paste
in a link to the new [% terms.bug %]. Otherwise, reopen this [% terms.bug %].
[% ELSIF message_tag == "buglist_adding_field" %]
[% title = "Adding field to search page..." %]
[% link = "Click here if the page does not redisplay automatically." %]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment