diff options
Diffstat (limited to 'Bugzilla/Search.pm')
-rw-r--r-- | Bugzilla/Search.pm | 42 |
1 files changed, 12 insertions, 30 deletions
diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm index 81b459ee5..2bbd4e451 100644 --- a/Bugzilla/Search.pm +++ b/Bugzilla/Search.pm @@ -309,9 +309,7 @@ use constant OPERATOR_FIELD_OVERRIDE => { 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, @@ -2269,25 +2267,6 @@ sub _content_matches { 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)}; @@ -2302,12 +2281,6 @@ sub _long_descs_count { $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)}; @@ -2588,11 +2561,12 @@ sub _multiselect_multiple { 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); } } @@ -2633,6 +2607,14 @@ sub _multiselect_table { $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; |