diff options
author | Perl Tidy <perltidy@bugzilla.org> | 2018-12-05 21:38:52 +0100 |
---|---|---|
committer | Dylan William Hardison <dylan@hardison.net> | 2018-12-05 23:49:08 +0100 |
commit | 8ec8da0491ad89604700b3e29a227966f6d84ba1 (patch) | |
tree | 9d270f173330ca19700e0ba9f2ee931300646de1 /Bugzilla/BugUrl/Bugzilla | |
parent | a7bb5a65b71644d9efce5fed783ed545b9336548 (diff) | |
download | bugzilla-8ec8da0491ad89604700b3e29a227966f6d84ba1.tar.gz bugzilla-8ec8da0491ad89604700b3e29a227966f6d84ba1.tar.xz |
no bug - reformat all the code using the new perltidy rules
Diffstat (limited to 'Bugzilla/BugUrl/Bugzilla')
-rw-r--r-- | Bugzilla/BugUrl/Bugzilla/Local.pm | 121 |
1 files changed, 59 insertions, 62 deletions
diff --git a/Bugzilla/BugUrl/Bugzilla/Local.pm b/Bugzilla/BugUrl/Bugzilla/Local.pm index 14d03f048..73086524e 100644 --- a/Bugzilla/BugUrl/Bugzilla/Local.pm +++ b/Bugzilla/BugUrl/Bugzilla/Local.pm @@ -20,83 +20,80 @@ use Bugzilla::Util; #### Initialization #### ############################### -use constant VALIDATOR_DEPENDENCIES => { - value => ['bug_id'], -}; +use constant VALIDATOR_DEPENDENCIES => {value => ['bug_id'],}; ############################### #### Methods #### ############################### sub ref_bug_url { - my $self = shift; - - if (!exists $self->{ref_bug_url}) { - my $ref_bug_id = new URI($self->name)->query_param('id'); - my $ref_bug = Bugzilla::Bug->check($ref_bug_id); - my $ref_value = $self->local_uri($self->bug_id); - $self->{ref_bug_url} = - new Bugzilla::BugUrl::Bugzilla::Local({ bug_id => $ref_bug->id, - value => $ref_value }); - } - return $self->{ref_bug_url}; + my $self = shift; + + if (!exists $self->{ref_bug_url}) { + my $ref_bug_id = new URI($self->name)->query_param('id'); + my $ref_bug = Bugzilla::Bug->check($ref_bug_id); + my $ref_value = $self->local_uri($self->bug_id); + $self->{ref_bug_url} = new Bugzilla::BugUrl::Bugzilla::Local( + {bug_id => $ref_bug->id, value => $ref_value}); + } + return $self->{ref_bug_url}; } sub should_handle { - my ($class, $uri) = @_; - - # Check if it is either a bug id number or an alias. - return 1 if $uri->as_string =~ m/^\w+$/; - - # Check if it is a local Bugzilla uri and call - # Bugzilla::BugUrl::Bugzilla to check if it's a valid Bugzilla - # see also url. - my $canonical_local = URI->new($class->local_uri)->canonical; - if ($canonical_local->authority eq $uri->canonical->authority - and $canonical_local->path eq $uri->canonical->path) - { - return $class->SUPER::should_handle($uri); - } - - return 0; + my ($class, $uri) = @_; + + # Check if it is either a bug id number or an alias. + return 1 if $uri->as_string =~ m/^\w+$/; + + # Check if it is a local Bugzilla uri and call + # Bugzilla::BugUrl::Bugzilla to check if it's a valid Bugzilla + # see also url. + my $canonical_local = URI->new($class->local_uri)->canonical; + if ( $canonical_local->authority eq $uri->canonical->authority + and $canonical_local->path eq $uri->canonical->path) + { + return $class->SUPER::should_handle($uri); + } + + return 0; } sub _check_value { - my ($class, $uri, undef, $params) = @_; - - # At this point we are going to treat any word as a - # bug id/alias to the local Bugzilla. - my $value = $uri->as_string; - if ($value =~ m/^\w+$/) { - $uri = new URI($class->local_uri($value)); - } else { - # It's not a word, then we have to check - # if it's a valid Bugzilla url. - $uri = $class->SUPER::_check_value($uri); - } - - my $ref_bug_id = $uri->query_param('id'); - my $ref_bug = Bugzilla::Bug->check($ref_bug_id); - my $self_bug_id = $params->{bug_id}; - $params->{ref_bug} = $ref_bug; - - if ($ref_bug->id == $self_bug_id) { - ThrowUserError('see_also_self_reference'); - } - - my $product = $ref_bug->product_obj; - if (!Bugzilla->user->can_edit_product($product->id)) { - ThrowUserError("product_edit_denied", - { product => $product->name }); - } - - return $uri; + my ($class, $uri, undef, $params) = @_; + + # At this point we are going to treat any word as a + # bug id/alias to the local Bugzilla. + my $value = $uri->as_string; + if ($value =~ m/^\w+$/) { + $uri = new URI($class->local_uri($value)); + } + else { + # It's not a word, then we have to check + # if it's a valid Bugzilla url. + $uri = $class->SUPER::_check_value($uri); + } + + my $ref_bug_id = $uri->query_param('id'); + my $ref_bug = Bugzilla::Bug->check($ref_bug_id); + my $self_bug_id = $params->{bug_id}; + $params->{ref_bug} = $ref_bug; + + if ($ref_bug->id == $self_bug_id) { + ThrowUserError('see_also_self_reference'); + } + + my $product = $ref_bug->product_obj; + if (!Bugzilla->user->can_edit_product($product->id)) { + ThrowUserError("product_edit_denied", {product => $product->name}); + } + + return $uri; } sub local_uri { - my ($self, $bug_id) = @_; - $bug_id ||= ''; - return Bugzilla->localconfig->{urlbase} . "show_bug.cgi?id=$bug_id"; + my ($self, $bug_id) = @_; + $bug_id ||= ''; + return Bugzilla->localconfig->{urlbase} . "show_bug.cgi?id=$bug_id"; } 1; |