diff options
author | mkanat%bugzilla.org <> | 2009-10-29 04:46:15 +0000 |
---|---|---|
committer | mkanat%bugzilla.org <> | 2009-10-29 04:46:15 +0000 |
commit | 65d75763b90b9485b52f15e2938951ad0fbfaa21 (patch) | |
tree | 0bc0f5bfd15af4dd7640f4569fa49a710fc0f3f5 /Bugzilla | |
parent | c51e34ce8c15bc53672bd58083196e6b2f2c254f (diff) | |
download | bugs-65d75763b90b9485b52f15e2938951ad0fbfaa21.tar bugs-65d75763b90b9485b52f15e2938951ad0fbfaa21.tar.gz bugs-65d75763b90b9485b52f15e2938951ad0fbfaa21.tar.bz2 bugs-65d75763b90b9485b52f15e2938951ad0fbfaa21.tar.xz bugs-65d75763b90b9485b52f15e2938951ad0fbfaa21.zip |
Bug 524234: When there are no search results, include helpful links
Patch by Max Kanat-Alexander <mkanat@bugzilla.org> r=dkl, a=mkanat
Diffstat (limited to 'Bugzilla')
-rw-r--r-- | Bugzilla/User.pm | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm index 7057ec90a..9cb53fe34 100644 --- a/Bugzilla/User.pm +++ b/Bugzilla/User.pm @@ -712,17 +712,19 @@ sub get_selectable_classifications { } sub can_enter_product { - my ($self, $product_name, $warn) = @_; + my ($self, $input, $warn) = @_; my $dbh = Bugzilla->dbh; - if (!defined($product_name)) { + if (!defined $input) { return unless $warn == THROW_ERROR; ThrowUserError('no_products'); } - my $product = new Bugzilla::Product({name => $product_name}); + my $product = blessed($input) ? $input + : new Bugzilla::Product({ name => $input }); my $can_enter = - $product && grep($_->name eq $product->name, @{$self->get_enterable_products}); + $product && grep($_->name eq $product->name, + @{ $self->get_enterable_products }); return 1 if $can_enter; @@ -731,21 +733,26 @@ sub can_enter_product { # Check why access was denied. These checks are slow, # but that's fine, because they only happen if we fail. + # We don't just use $product->name for error messages, because if it + # changes case from $input, then that's a clue that the product does + # exist but is hidden. + my $name = blessed($input) ? $input->name : $input; + # The product could not exist or you could be denied... if (!$product || !$product->user_has_access($self)) { - ThrowUserError('entry_access_denied', {product => $product_name}); + ThrowUserError('entry_access_denied', { product => $name }); } # It could be closed for bug entry... elsif (!$product->is_active) { - ThrowUserError('product_disabled', {product => $product}); + ThrowUserError('product_disabled', { product => $product }); } # It could have no components... elsif (!@{$product->components}) { - ThrowUserError('missing_component', {product => $product}); + ThrowUserError('missing_component', { product => $product }); } # It could have no versions... elsif (!@{$product->versions}) { - ThrowUserError ('missing_version', {product => $product}); + ThrowUserError ('missing_version', { product => $product }); } die "can_enter_product reached an unreachable location."; |