changedto => \&_invalid_combination,
_default => \&_long_descs_count,
},
- 'longdescs.isprivate' => {
- _default => \&_longdescs_isprivate,
- },
+ 'longdescs.isprivate' => MULTI_SELECT_OVERRIDE,
owner_idle_time => {
greaterthan => \&_owner_idle_time_greater_less,
greaterthaneq => \&_owner_idle_time_greater_less,
COLUMNS->{'relevance'}->{name} = $select_term;
}
-sub _join_longdescs {
- my ($self, $args) = @_;
- my ($chart_id, $joins) = @$args{qw(chart_id joins)};
-
- my $table = "longdescs_$chart_id";
- my $extra = $self->_user->is_insider ? [] : ["$table.isprivate = 0"];
- my $join = {
- table => 'longdescs',
- as => $table,
- extra => $extra,
- };
- # We only want to do an INNER JOIN if we're not checking isprivate.
- # Otherwise we'd exclude all bugs with only private comments from
- # the search entirely.
- $join->{join} = 'INNER' if $self->_user->is_insider;
- push(@$joins, $join);
- return $table;
-}
-
sub _long_descs_count {
my ($self, $args) = @_;
my ($chart_id, $joins) = @$args{qw(chart_id joins)};
$args->{full_field} = "${table}.num";
}
-sub _longdescs_isprivate {
- my ($self, $args) = @_;
- my $table = $self->_join_longdescs($args);
- $args->{full_field} = "$table.isprivate";
-}
-
sub _work_time_changedby {
my ($self, $args) = @_;
my ($chart_id, $joins, $value) = @$args{qw(chart_id joins value)};
push(@terms, $self->_multiselect_term($args));
}
+ # The spacing in the joins helps make the resulting SQL more readable.
if ($operator =~ /^any/) {
- $args->{term} = join(" OR ", @terms);
+ $args->{term} = join("\n OR ", @terms);
}
else {
- $args->{term} = join(" AND ", @terms);
+ $args->{term} = join("\n AND ", @terms);
}
}
$args->{full_field} = 'thetext';
return "longdescs";
}
+ elsif ($field eq 'longdescs.isprivate') {
+ ThrowUserError('auth_failure', { action => 'search',
+ object => 'bug_fields',
+ field => 'longdescs.isprivate' })
+ if !$self->_user->is_insider;
+ $args->{full_field} = 'isprivate';
+ return "longdescs";
+ }
my $table = "bug_$field";
$args->{full_field} = "bug_$field.value";
return $table;
'attachments.mimetype' => { contains => [5] },
bug_file_loc => { contains => [5] },
deadline => { contains => [5] },
- 'longdescs.isprivate' => { contains => [1] },
# Custom fields are busted because they can be NULL.
FIELD_TYPE_FREETEXT, { contains => [5] },
FIELD_TYPE_BUG_ID, { contains => [5] },
# nowords and nowordssubstr have these broken tests in common.
#
# flagtypes.name doesn't match bugs without flags.
-# longdescs.isprivate actually works properly in
-# terms of excluding bug 1 (since we exclude all values in the search,
-# on our test), but still fails at including bug 5.
-# The longdesc* fields, coincidentally, work completely
-# correctly, possibly because there's only one comment on bug 5.
use constant NOWORDS_BROKEN => (
NEGATIVE_BROKEN,
'flagtypes.name' => { contains => [5] },
- 'longdescs.isprivate' => {},
);
# Fields that don't generally work at all with changed* searches, but
notsubstring => { NEGATIVE_BROKEN },
notregexp => { NEGATIVE_BROKEN },
- # longdescs.isprivate matches if any comment matches, instead of if all
- # comments match. (Commenter is probably
- # also broken in this way, but all our comments come from the same user.)
- lessthan => {
- 'longdescs.isprivate' => { contains => [1] },
- },
- # The lessthaneq tests are broken for the same reasons, but they work
- # slightly differently so they have a different set of broken tests.
- lessthaneq => {
- 'longdescs.isprivate' => { contains => [1] },
- },
-
greaterthan => { GREATERTHAN_BROKEN },
greaterthaneq => { GREATERTHAN_BROKEN },
"bug_file_loc" => { contains => [5] },
"deadline" => { contains => [5] },
"flagtypes.name" => { contains => [5] },
- "longdescs.isprivate" => { contains => [1] },
FIELD_TYPE_BUG_ID, { contains => [5] },
FIELD_TYPE_DATETIME, { contains => [5] },
FIELD_TYPE_FREETEXT, { contains => [5] },
'attach_data.thedata' => { contains => [5] },
cc => { },
'flagtypes.name' => { contains => [5] },
- 'longdescs.isprivate' => { },
},
allwordssubstr => {
COMMON_BROKEN_NOT,
},
'allwordssubstr-<1>,<2>' => {
cc => { },
- "longdescs.isprivate" => { },
},
anyexact => {
COMMON_BROKEN_NOT,
},
lessthan => {
COMMON_BROKEN_NOT,
- 'longdescs.isprivate' => { },
},
lessthaneq => {
COMMON_BROKEN_NOT,
- 'longdescs.isprivate' => { },
},
notequals => { NEGATIVE_BROKEN_NOT },
notregexp => { NEGATIVE_BROKEN_NOT },
cclist_accessible => { value => 1, contains => [2,3,4,5] },
reporter_accessible => { value => 1, contains => [2,3,4,5] },
'longdescs.count' => { value => 3, contains => [2,3,4,5] },
- 'longdescs.isprivate' => { value => 1, contains => [2,3,4,5] },
+ 'longdescs.isprivate' => { value => 1, contains => [1,2,3,4,5] },
everconfirmed => { value => 1, contains => [2,3,4,5] },
creation_ts => { value => '2037-01-02', contains => [1,5] },
delta_ts => { value => '2037-01-02', contains => [1,5] },
cclist_accessible => { value => 0, contains => [2,3,4,5] },
reporter_accessible => { value => 0, contains => [2,3,4,5] },
'longdescs.count' => { value => 2, contains => [2,3,4,5] },
- 'longdescs.isprivate' => { value => 0, contains => [2,3,4,5] },
+ 'longdescs.isprivate' => { value => -1, contains => [] },
everconfirmed => { value => 0, contains => [2,3,4,5] },
blocked => { contains => [1,2] },
dependson => { contains => [1,3] },
override => {
dependson => { value => '<1-id> <3-id>', contains => [] },
# bug 3 has the value "21" here, so matches "2,1"
- percentage_complete => { value => '<2>,<3>', contains => [3] }
+ percentage_complete => { value => '<2>,<3>', contains => [3] },
+ # 1 0 matches bug 1, which has both public and private comments.
+ 'longdescs.isprivate' => { contains => [1] },
}
},
],
override => { MULTI_BOOLEAN_OVERRIDE } },
{ contains => [], value => '<1> <2>',
override => {
- dependson => { contains => [], value => '<2-id> <3-id>' }
+ dependson => { contains => [], value => '<2-id> <3-id>' },
+ # 1 0 matches bug 1, which has both public and private comments.
+ 'longdescs.isprivate' => { contains => [1] },
}
},
],