Bug 72826, Bug 64428

git-svn-id: svn://svn.office.custis.ru/3rdparty/bugzilla.org/trunk@1151 6955db30-a419-402b-8a0d-67ecbb4d7f56
master
vfilippov 2010-12-08 19:59:45 +00:00
parent 121c37d832
commit fac345b95b
12 changed files with 65 additions and 37 deletions

View File

@ -683,7 +683,7 @@ sub init {
my $extra;
if (!@chfield || @actlist)
{
$extra = '1';
$extra = "1=1";
$extra .= $from_term if $sql_chfrom;
$extra .= $to_term if $sql_chto;
$extra .= $value_term if $sql_chvalue;
@ -701,7 +701,7 @@ sub init {
# http://wiki.office.custis.ru/Bugzilla_-_оптимизация_поиска_по_изменениям
if (!@chfield || $seen_longdesc)
{
$extra = "1";
$extra = "1=1";
$extra .= " AND actcheck_comment.bug_when >= $sql_chfrom" if $sql_chfrom;
$extra .= " AND actcheck_comment.bug_when <= $sql_chto" if $sql_chto;
$extra .= " AND actcheck_comment.who = $chfieldwho" if $chfieldwho;
@ -1692,7 +1692,7 @@ sub _content_matches
UNION SELECT bug_id FROM bugs_fulltext WHERE $term2) AS $table ON bugs.bug_id=$table.bug_id";
# All work done by INNER JOIN
$$term = "1";
$$term = "1=1";
}
else
{
@ -2169,7 +2169,7 @@ sub _keywords_nonchanged {
# CustIS Bug 65346 - keyword search is broken in 3.6
$$f = "(SELECT IFNULL(GROUP_CONCAT($kd_table.name SEPARATOR ' '), '') FROM keywords AS $k_table " .
$$f = "(SELECT COALESCE(".Bugzilla->dbh->sql_group_concat("$kd_table.name", "' '").", '') FROM keywords AS $k_table " .
" LEFT JOIN keyworddefs AS $kd_table ON $kd_table.id=$k_table.keywordid" .
" WHERE $k_table.bug_id = bugs.bug_id)";
}

View File

@ -685,7 +685,7 @@ sub visible_bugs {
my $sth;
# Speed up the can_see_bug case.
if (scalar(@check_ids) == 1) {
$sth = $self->{_sth_one_visible_bug};
$sth = Bugzilla->dbh->{_sth_one_visible_bug};
}
$sth ||= $dbh->prepare(
# This checks for groups that the bug is in that the user
@ -711,7 +711,7 @@ sub visible_bugs {
WHERE bugs.bug_id IN (' . join(',', ('?') x @check_ids) . ')
AND creation_ts IS NOT NULL ');
if (scalar(@check_ids) == 1) {
$self->{_sth_one_visible_bug} = $sth;
Bugzilla->dbh->{_sth_one_visible_bug} = $sth;
}
$sth->execute(@check_ids);

View File

@ -731,9 +731,13 @@ sub update {
$vars->{'attachment'} = $attachment;
$vars->{'bugs'} = [$bug];
$vars->{'header_done'} = 1;
my $silent = $vars->{commentsilent} = $cgi->param('commentsilent') ? 1 : 0;
$vars->{'sent_bugmail'} =
Bugzilla::BugMail::Send($bug->id, { 'changer' => $user->login }, $silent);
# TODO save this into session and redirect
my $sent = send_results({
bug_id => $bug->id,
mailrecipients => { 'changer' => $user->login },
});
$vars->{$_} = $sent->{$_} for keys %$sent;
$cgi->send_header();
@ -805,9 +809,12 @@ sub delete_attachment {
$vars->{'bugs'} = [$bug];
$vars->{'header_done'} = 1;
my $silent = $vars->{commentsilent} = $cgi->param('commentsilent') ? 1 : 0;
$vars->{'sent_bugmail'} =
Bugzilla::BugMail::Send($bug->id, { 'changer' => $user->login }, $silent);
# TODO save this into session and redirect
my $sent = send_results({
bug_id => $bug->id,
mailrecipients => { 'changer' => $user->login },
});
$vars->{$_} = $sent->{$_} for keys %$sent;
$template->process("attachment/updated.html.tmpl", $vars)
|| ThrowTemplateError($template->error());

View File

@ -584,7 +584,7 @@ elsif (($cmdtype eq "doit") && defined $cgi->param('remtype')) {
ThrowUserError('no_bugs_in_list', {name => $query_name,
query_id => $query_id});
}
$new_query = "bug_id=" . join(',', sort {$a <=> $b} @bug_ids);
$new_query = "bug_id_type=anyexact&bug_id=" . join(',', sort {$a <=> $b} @bug_ids);
$query_type = LIST_OF_BUGS;
}
my $tofooter = 1;

View File

@ -656,7 +656,11 @@ if ($action eq 'search') {
# Send mail about what we've done to bugs.
# The deleted user is not notified of the changes.
foreach (keys(%updatedbugs)) {
Bugzilla::BugMail::Send($_, {'changer' => $user->login} );
# TODO save this into session and redirect
send_results({
bug_id => $_,
mailrecipients => { 'changer' => $user->login },
});
}
###########################################################################

View File

@ -11,20 +11,21 @@ sub buglist_columns
{
my ($args) = @_;
my $columns = $args->{columns};
my $dbh = Bugzilla->dbh;
$columns->{dependson} = {
name => "(SELECT GROUP_CONCAT(bugblockers.dependson SEPARATOR ',') FROM dependencies bugblockers WHERE bugblockers.blocked=bugs.bug_id)",
name => "(SELECT ".$dbh->sql_group_concat('bugblockers.dependson', "','")." FROM dependencies bugblockers WHERE bugblockers.blocked=bugs.bug_id)",
title => "Bug dependencies",
};
$columns->{blocked} = {
name => "(SELECT GROUP_CONCAT(bugblocked.blocked SEPARATOR ',') FROM dependencies bugblocked WHERE bugblocked.dependson=bugs.bug_id)",
name => "(SELECT ".$dbh->sql_group_concat('bugblocked.blocked', "','")." FROM dependencies bugblocked WHERE bugblocked.dependson=bugs.bug_id)",
title => "Bugs blocked",
};
$columns->{flags} = {
name =>
"(SELECT GROUP_CONCAT(CONCAT(col_ft.name,col_f.status) SEPARATOR ', ')
"(SELECT ".$dbh->sql_group_concat($dbh->sql_string_concat('col_ft.name', 'col_f.status'), "', '")."
FROM flags col_f JOIN flagtypes col_ft ON col_f.type_id=col_ft.id
WHERE col_f.bug_id=bugs.bug_id AND (col_ft.is_requesteeble=0 OR col_ft.is_requestable=0))",
title => "Flags",
@ -32,7 +33,14 @@ WHERE col_f.bug_id=bugs.bug_id AND (col_ft.is_requesteeble=0 OR col_ft.is_reques
$columns->{requests} = {
name =>
"(SELECT GROUP_CONCAT(CONCAT(col_ft.name,col_f.status,CASE WHEN col_p.login_name IS NULL THEN '' ELSE CONCAT(' ',col_p.login_name) END) SEPARATOR ', ')
"(SELECT ".
$dbh->sql_group_concat(
$dbh->sql_string_concat(
'col_ft.name', 'col_f.status',
'CASE WHEN col_p.login_name IS NULL THEN \'\' ELSE '.
$dbh->sql_string_concat("' '", 'col_p.login_name').' END'
), "', '"
)."
FROM flags col_f JOIN flagtypes col_ft ON col_f.type_id=col_ft.id
LEFT JOIN profiles col_p ON col_f.requestee_id=col_p.userid
WHERE col_f.bug_id=bugs.bug_id AND col_ft.is_requesteeble=1 AND col_ft.is_requestable=1)",
@ -54,7 +62,7 @@ WHERE col_f.bug_id=bugs.bug_id AND col_ft.is_requesteeble=1 AND col_ft.is_reques
### Testopia ###
$columns->{test_cases} = {
title => "Test cases",
name => "(SELECT GROUP_CONCAT(DISTINCT tcb.case_id SEPARATOR ', ') FROM test_case_bugs tcb WHERE tcb.bug_id=bugs.bug_id)",
name => "(SELECT ".$dbh->sql_group_concat("case_id", "', '")." FROM (SELECT DISTINCT tcb.case_id FROM test_case_bugs tcb WHERE tcb.bug_id=bugs.bug_id) t)",
};
### end Testopia ###

View File

@ -313,4 +313,7 @@ $sel->click_ok("link=Forget Search 'Selenium bugs'");
$sel->wait_for_page_to_load(WAIT_TIME);
$sel->title_is("Search is gone");
$sel->is_text_present_ok("OK, the Selenium bugs search is gone.");
delete_bugs($sel, $config, [$bug1_id, $bug2_id, $bug3_id, $bug4_id]);
logout($sel);

View File

@ -46,7 +46,7 @@ $sel->type_ok("description", "public attachment, v2");
$sel->check_ok("ispatch");
# The existing attachment name must be displayed, to mark it as obsolete.
$sel->is_text_present_ok("private attachment, v1");
$sel->type_ok("comment", "this patch is public. Everyone can see it.");
$sel->type_ok("comment_textarea", "this patch is public. Everyone can see it.");
$sel->value_is("isprivate", "off");
$sel->click_ok("create");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
@ -95,7 +95,7 @@ $sel->check_ok("ispatch");
# The user doesn't have editbugs privs.
$sel->is_text_present_ok("[no attachments can be made obsolete]");
$sel->type_ok("description", "My patch, which I should see, always");
$sel->type_ok("comment", "This is my patch!");
$sel->type_ok("comment_textarea", "This is my patch!");
$sel->click_ok("create");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_like(qr/^Attachment \d+ added to Bug \d+/);
@ -120,7 +120,7 @@ $sel->click_ok('//a[@href="attachment.cgi?id=' . $attachment2_id . '&action=edit
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Attachment $attachment2_id Details for Bug $bug1_id");
$sel->check_ok("isprivate");
$sel->type_ok("comment", "Making the powerless user's patch private.");
$sel->type_ok("comment_textarea", "Making the powerless user's patch private.");
$sel->click_ok("update");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Changes Submitted to Attachment $attachment2_id of Bug $bug1_id");
@ -161,8 +161,8 @@ $sel->wait_for_page_to_load_ok(WAIT_TIME);
logout($sel);
log_in($sel, $config, 'admin');
set_parameters($sel, {
"Group Security" => {"insidergroup" => { type => "select",
value => "QA-Selenium-TEST" }},
"Group Security" => {"insidergroup" => { type => "select",
value => "InsiderGroup" }},
});
delete_bugs($sel, $config, [$bug1_id]);

View File

@ -10,7 +10,7 @@ my ($sel, $config) = get_selenium();
# If a saved search named 'SavedSearchTEST1' exists, remove it.
log_in($sel, $config, 'QA_Selenium_TEST');
log_in($sel, $config, 'unprivileged');
$sel->click_ok("link=Preferences");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("User Preferences");

View File

@ -7,6 +7,7 @@ use Test::More "no_plan";
use QA::Util;
my ($sel, $config) = get_selenium();
my $text;
# Set the querysharegroup param to be the canconfirm group.
@ -22,9 +23,9 @@ $sel->title_is("Bug List");
$sel->type_ok("save_newqueryname", "Shared Selenium buglist");
$sel->click_ok("remember");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Search created");
my $text = trim($sel->get_text("message"));
_ok($text =~ /OK, you have a new search named Shared Selenium buglist./, "New search named 'Shared Selenium buglist' has been created");
$sel->title_like(qr/Search (created|updated)/);
#$text = trim($sel->get_text("message"));
#_ok($text =~ /OK, you have a new search named Shared Selenium buglist./, "New search named 'Shared Selenium buglist' has been created");
# Retrieve the newly created saved search's internal ID and make sure it's displayed
# in the footer by default.
@ -93,9 +94,9 @@ $sel->title_is("Bug List");
$sel->type_ok("save_newqueryname", "helpwanted");
$sel->click_ok("remember");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Search created");
$text = trim($sel->get_text("message"));
_ok($text =~ /OK, you have a new search named helpwanted./, "New search named helpwanted has been created");
$sel->title_like(qr/Search (created|updated)/);
#$text = trim($sel->get_text("message"));
#_ok($text =~ /OK, you have a new search named helpwanted./, "New search named helpwanted has been created");
$sel->click_ok("link=Preferences");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
@ -156,10 +157,10 @@ $text = trim($sel->get_text("message"));
_ok($text =~ /OK, the Shared Selenium buglist search is gone./, "The 'Shared Selenium buglist' search is gone");
logout($sel);
# Make sure that the 'helpwanted' query is not shared with the QA_Selenium_TEST
# Make sure that the 'helpwanted' query is not shared with the unprivileged
# user as he doesn't belong to the 'canconfirm' group.
log_in($sel, $config, 'QA_Selenium_TEST');
log_in($sel, $config, 'unprivileged');
_ok(!$sel->is_text_present("helpwanted"), "The 'helpwanted' query is not displayed in the footer");
$sel->click_ok("link=Preferences");
$sel->wait_for_page_to_load_ok(WAIT_TIME);

View File

@ -36,10 +36,11 @@
<div class="user-error-div">
<div class="user-error-div-first">
[% IF error_message.match('^\s*<[a-z]') %]
<div class="user-error-div-first" id="error_msg">
[% error_message %]
[% ELSE %]
<div class="user-error-div-first">
<p style="margin-top: 0; margin-bottom: 0" id="error_msg">[% error_message.replace("\n\n", "</p><p style='margin-bottom: 0'>") FILTER none %]</p>
[% END %]
</div>

View File

@ -352,9 +352,13 @@ sub record_votes {
$vars->{'title_tag'} = 'change_votes';
foreach my $bug_id (@updated_bugs) {
$vars->{'id'} = $bug_id;
$vars->{'sent_bugmail'} = Bugzilla::BugMail::Send($bug_id,
{ 'changer' => Bugzilla->user->login });
# TODO save this into session and redirect
my $sent = send_results({
bug_id => $bug_id,
mailrecipients => { 'changer' => Bugzilla->user->login },
type => "votes",
});
$vars->{$_} = $sent->{$_} for keys %$sent;
$template->process("bug/process/results.html.tmpl", $vars)
|| ThrowTemplateError($template->error());