From abfbdfc45c71af6a14bcc4cd5354044cfca14add Mon Sep 17 00:00:00 2001 From: dklawren Date: Fri, 15 Mar 2019 14:52:54 -0400 Subject: Bug 1535376 - add support for upstream phabricator to the see-also fields (from: https://github.com/mozilla-bteam/bmo/commit/fc3a97a79e15a15b8c66f9ff8088dd2b015d5ca4) Signed-off-by: Sam James --- Bugzilla/BugUrl.pm | 1 + Bugzilla/BugUrl/Phabricator.pm | 41 +++++++++++++++++++++++++ template/en/default/global/user-error.html.tmpl | 1 + 3 files changed, 43 insertions(+) create mode 100644 Bugzilla/BugUrl/Phabricator.pm diff --git a/Bugzilla/BugUrl.pm b/Bugzilla/BugUrl.pm index 42e993bf4..9aa7ac7f5 100644 --- a/Bugzilla/BugUrl.pm +++ b/Bugzilla/BugUrl.pm @@ -66,6 +66,7 @@ use constant SUB_CLASSES => qw( Bugzilla::BugUrl::SourceForge Bugzilla::BugUrl::GitHub Bugzilla::BugUrl::GitLab + Bugzilla::BugUrl::Phabricator ); ############################### diff --git a/Bugzilla/BugUrl/Phabricator.pm b/Bugzilla/BugUrl/Phabricator.pm new file mode 100644 index 000000000..b805248cf --- /dev/null +++ b/Bugzilla/BugUrl/Phabricator.pm @@ -0,0 +1,41 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This Source Code Form is "Incompatible With Secondary Licenses", as +# defined by the Mozilla Public License, v. 2.0. + +package Bugzilla::BugUrl::Phabricator; + +use 5.10.1; +use strict; +use warnings; +use base qw(Bugzilla::BugUrl); + +############################### +#### Methods #### +############################### + +sub should_handle { + my ($class, $uri) = @_; + # https://admin.phacility.com/PHI\d+ + # https://secure.phabricator.com/T\d+ + # https://secure.phabricator.com/D\d+ + return ($uri->path =~ m#/(PHI|D|T)\d+$#) ? 1 : 0; +} + +sub _check_value { + my $class = shift; + + my $uri = $class->SUPER::_check_value(@_); + + # Make sure there are no query parameters. + $uri->query(undef); + + # And remove any # part if there is one. + $uri->fragment(undef); + + return $uri; +} + +1; diff --git a/template/en/default/global/user-error.html.tmpl b/template/en/default/global/user-error.html.tmpl index 79611ebed..4ebb0b95b 100644 --- a/template/en/default/global/user-error.html.tmpl +++ b/template/en/default/global/user-error.html.tmpl @@ -293,6 +293,7 @@
  • An issue/pull request on github.com.
  • An issue/merge request on a GitLab system.
  • A task on a Flyspray tracking system.
  • +
  • A revision, support ticket, or task in Phabricator.
  • [% Hook.process('bug_url_invalid_tracker') %] [% END %] -- cgit v1.2.3-65-gdbad