mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 04:15:43 +00:00
Bug 279738: Move GetLongDescriptionAsText() out of globals.pl - Patch by Fr�d�ric Buclin <LpSolit@gmail.com> r=mkanat a=myk
This commit is contained in:
parent
53be54854b
commit
8d869746f5
@ -309,7 +309,7 @@ sub ProcessOneBug {
|
||||
}
|
||||
|
||||
|
||||
my ($newcomments, $anyprivate) = &::GetLongDescriptionAsText($id, $start, $end);
|
||||
my ($newcomments, $anyprivate) = get_comments_by_bug($id, $start, $end);
|
||||
|
||||
###########################################################################
|
||||
# Start of email filtering code
|
||||
@ -736,4 +736,55 @@ sub MailPassword {
|
||||
MessageToMTA($msg);
|
||||
}
|
||||
|
||||
# Get bug comments for the given period and format them to be used in emails.
|
||||
sub get_comments_by_bug {
|
||||
my ($id, $start, $end) = @_;
|
||||
my $dbh = Bugzilla->dbh;
|
||||
|
||||
my $result = "";
|
||||
my $count = 0;
|
||||
my $anyprivate = 0;
|
||||
|
||||
my $query = 'SELECT profiles.login_name, ' .
|
||||
$dbh->sql_date_format('longdescs.bug_when', '%Y.%m.%d %H:%i') . ',
|
||||
longdescs.thetext, longdescs.isprivate,
|
||||
longdescs.already_wrapped
|
||||
FROM longdescs
|
||||
INNER JOIN profiles ON profiles.userid = longdescs.who
|
||||
WHERE longdescs.bug_id = ? ';
|
||||
|
||||
my @args = ($id);
|
||||
|
||||
# $start will be undef for new bugs, and defined for pre-existing bugs.
|
||||
if ($start) {
|
||||
# If $start is not NULL, obtain the count-index
|
||||
# of this comment for the leading "Comment #xxx" line.
|
||||
$count = $dbh->selectrow_array('SELECT COUNT(*) FROM longdescs
|
||||
WHERE bug_id = ? AND bug_when <= ?',
|
||||
undef, ($id, $start));
|
||||
|
||||
$query .= ' AND longdescs.bug_when > ?
|
||||
AND longdescs.bug_when <= ? ';
|
||||
push @args, ($start, $end);
|
||||
}
|
||||
|
||||
$query .= ' ORDER BY longdescs.bug_when';
|
||||
my $comments = $dbh->selectall_arrayref($query, undef, @args);
|
||||
|
||||
foreach (@$comments) {
|
||||
my ($who, $when, $text, $isprivate, $already_wrapped) = @$_;
|
||||
if ($count) {
|
||||
$result .= "\n\n------- Comment #$count from $who" .
|
||||
Param('emailsuffix'). " " . format_time($when) .
|
||||
" -------\n";
|
||||
}
|
||||
if ($isprivate > 0 && Param('insidergroup')) {
|
||||
$anyprivate = 1;
|
||||
}
|
||||
$result .= ($already_wrapped ? $text : wrap_comment($text));
|
||||
$count++;
|
||||
}
|
||||
return ($result, $anyprivate);
|
||||
}
|
||||
|
||||
1;
|
||||
|
@ -954,51 +954,6 @@ sub GetBugLink {
|
||||
}
|
||||
}
|
||||
|
||||
sub GetLongDescriptionAsText {
|
||||
my ($id, $start, $end) = (@_);
|
||||
my $result = "";
|
||||
my $count = 0;
|
||||
my $anyprivate = 0;
|
||||
my $dbh = Bugzilla->dbh;
|
||||
my ($query) = ("SELECT profiles.login_name, " .
|
||||
$dbh->sql_date_format('longdescs.bug_when', '%Y.%m.%d %H:%i') . ", " .
|
||||
" longdescs.thetext, longdescs.isprivate, " .
|
||||
" longdescs.already_wrapped " .
|
||||
"FROM longdescs, profiles " .
|
||||
"WHERE profiles.userid = longdescs.who " .
|
||||
"AND longdescs.bug_id = $id ");
|
||||
|
||||
# $start will be undef for New bugs, and defined for pre-existing bugs.
|
||||
if ($start) {
|
||||
# If $start is not NULL, obtain the count-index
|
||||
# of this comment for the leading "Comment #xxx" line.)
|
||||
SendSQL("SELECT count(*) FROM longdescs " .
|
||||
" WHERE bug_id = $id AND bug_when <= '$start'");
|
||||
($count) = (FetchSQLData());
|
||||
|
||||
$query .= " AND longdescs.bug_when > '$start'"
|
||||
. " AND longdescs.bug_when <= '$end' ";
|
||||
}
|
||||
|
||||
$query .= "ORDER BY longdescs.bug_when";
|
||||
SendSQL($query);
|
||||
while (MoreSQLData()) {
|
||||
my ($who, $when, $text, $isprivate, $work_time, $already_wrapped) =
|
||||
(FetchSQLData());
|
||||
if ($count) {
|
||||
$result .= "\n\n------- Comment #$count from $who".Param('emailsuffix')." ".
|
||||
Bugzilla::Util::format_time($when) . " -------\n";
|
||||
}
|
||||
if (($isprivate > 0) && Param("insidergroup")) {
|
||||
$anyprivate = 1;
|
||||
}
|
||||
$result .= ($already_wrapped ? $text : wrap_comment($text));
|
||||
$count++;
|
||||
}
|
||||
|
||||
return ($result, $anyprivate);
|
||||
}
|
||||
|
||||
# Returns a list of all the legal values for a field that has a
|
||||
# list of legal values, like rep_platform or resolution.
|
||||
sub get_legal_field_values {
|
||||
|
Loading…
Reference in New Issue
Block a user