From: dklawren Date: Fri, 15 Mar 2019 18:52:54 +0000 (-0400) Subject: Bug 1535376 - add support for upstream phabricator to the see-also fields X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fc3a97a79e15a15b8c66f9ff8088dd2b015d5ca4;p=thirdparty%2Fbugzilla.git Bug 1535376 - add support for upstream phabricator to the see-also fields --- diff --git a/Bugzilla/BugUrl.pm b/Bugzilla/BugUrl.pm index e6c68416c..1e68434aa 100644 --- a/Bugzilla/BugUrl.pm +++ b/Bugzilla/BugUrl.pm @@ -70,6 +70,7 @@ use constant SUB_CLASSES => qw( Bugzilla::BugUrl::WebCompat Bugzilla::BugUrl::ServiceNow Bugzilla::BugUrl::Splat + 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 29b358b2b..40ac8c5b0 100644 --- a/template/en/default/global/user-error.html.tmpl +++ b/template/en/default/global/user-error.html.tmpl @@ -355,6 +355,7 @@
  • An issue on webcompat.com.
  • A request on ServiceNow.
  • A ticket on hellosplat.com.
  • +
  • A revision, support ticket, or task in Phabricator.
  • [% ELSIF reason == 'id' %] There is no valid [% terms.bug %] id in that URL.