diff options
author | Max Kanat-Alexander <mkanat@bugzilla.org> | 2011-03-03 19:24:16 +0100 |
---|---|---|
committer | Max Kanat-Alexander <mkanat@bugzilla.org> | 2011-03-03 19:24:16 +0100 |
commit | 76243147c028c485d8b01c164570daa749c590e8 (patch) | |
tree | 6bff1910748f6556a5756f8be2d3087b0f005e10 /Bugzilla | |
parent | b8566e4d8f5bc2df8b90c857a99c0f5c0beaebd8 (diff) | |
download | bugzilla-76243147c028c485d8b01c164570daa749c590e8.tar.gz bugzilla-76243147c028c485d8b01c164570daa749c590e8.tar.xz |
Bug 638489 - Make all boolean charts work with longdescs.isprivate
r=mkanat, a=mkanat (module owner)
Diffstat (limited to 'Bugzilla')
-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; |