From d94865b30a92be8a3a900f8d1d8262d36044b1ca Mon Sep 17 00:00:00 2001 From: Tiago Mello Date: Tue, 24 Aug 2010 18:03:20 -0300 Subject: Bug 583243: Add a new hook 'search_operator_field_override'. r/a=mkanat --- extensions/Example/Extension.pm | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'extensions/Example') diff --git a/extensions/Example/Extension.pm b/extensions/Example/Extension.pm index 87061aa06..4d85d01f8 100644 --- a/extensions/Example/Extension.pm +++ b/extensions/Example/Extension.pm @@ -196,6 +196,27 @@ sub buglist_columns { $columns->{'example'} = { 'name' => 'bugs.delta_ts' , 'title' => 'Example' }; } +sub search_operator_field_override { + my ($self, $args) = @_; + + my $operators = $args->{'operators'}; + + my $original = $operators->{component}->{_non_changed}; + $operators->{component} = { + _non_changed => sub { _component_nonchanged($original, @_) } + }; +} + +sub _component_nonchanged { + my $original = shift; + my ($invocant, $args) = @_; + + $invocant->$original($args); + # Actually, it does not change anything in the result, + # just an example. + $args->{term} = $args->{term} . " OR 1=2"; +} + sub bugmail_recipients { my ($self, $args) = @_; my $recipients = $args->{recipients}; -- cgit v1.2.1