diff options
author | Tiago Mello <timello@bugzilla.org> | 2011-11-28 23:52:14 +0100 |
---|---|---|
committer | Frédéric Buclin <LpSolit@gmail.com> | 2011-11-28 23:52:14 +0100 |
commit | 02b78e06db9831cbf778b66016293057b08011c0 (patch) | |
tree | 7d76c2fc91cd878b12ccd444c0b2909692cdeddf /Bugzilla/BugUrl | |
parent | 2fe1db36b3ced43ca9b76a5fbc293c845fd13066 (diff) | |
download | bugzilla-02b78e06db9831cbf778b66016293057b08011c0.tar.gz bugzilla-02b78e06db9831cbf778b66016293057b08011c0.tar.xz |
Bug 687725: Adding a local bug ID in the See Also field isn't logged in the bug history of that bug
r/a=LpSolit
Diffstat (limited to 'Bugzilla/BugUrl')
-rw-r--r-- | Bugzilla/BugUrl/Bugzilla/Local.pm | 45 |
1 files changed, 2 insertions, 43 deletions
diff --git a/Bugzilla/BugUrl/Bugzilla/Local.pm b/Bugzilla/BugUrl/Bugzilla/Local.pm index bdfae2835..99f944fa6 100644 --- a/Bugzilla/BugUrl/Bugzilla/Local.pm +++ b/Bugzilla/BugUrl/Bugzilla/Local.pm @@ -42,56 +42,15 @@ sub ref_bug_url { 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, + new Bugzilla::BugUrl::Bugzilla::Local({ bug_id => $ref_bug->id, value => $ref_value }); } return $self->{ref_bug_url}; } -sub insert_create_data { - my ($class, $field_values) = @_; - - my $ref_bug = delete $field_values->{ref_bug}; - my $bug_url = $class->SUPER::insert_create_data($field_values); - my $url = $class->local_uri($bug_url->bug_id); - - # Check if the ref bug has already the url and then, - # update the ref bug to point to the current bug. - if (!grep { $_->name eq $url } @{ $ref_bug->see_also }) { - $class->SUPER::insert_create_data({ value => $url, - bug_id => $ref_bug->id, - class => ref($class) || $class }); - } - - return $bug_url; -} - -sub remove_from_db { - my $self = shift; - - my $dbh = Bugzilla->dbh; - my $ref_bug_url = $self->ref_bug_url; - - $dbh->bz_start_transaction(); - - # We remove the current see also first so then we - # avoid infinite loop later. - $self->SUPER::remove_from_db(); - - # We also remove the referenced bug url. - if (defined $ref_bug_url) { - my $ref_bug = Bugzilla::Bug->check($ref_bug_url->bug_id); - my $product = $ref_bug->product_obj; - if (Bugzilla->user->can_edit_product($product->id)) { - $ref_bug_url->remove_from_db(); - } - } - - $dbh->bz_commit_transaction(); -} - sub should_handle { my ($class, $uri) = @_; |