aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Bugzilla/BugUrl.pm1
-rw-r--r--Bugzilla/BugUrl/Phabricator.pm41
-rw-r--r--template/en/default/global/user-error.html.tmpl1
3 files changed, 43 insertions, 0 deletions
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 @@
<li>An issue/pull request on github.com.</li>
<li>An issue/merge request on a GitLab system.</li>
<li>A task on a Flyspray tracking system.</li>
+ <li>A revision, support ticket, or task in Phabricator.</li>
[% Hook.process('bug_url_invalid_tracker') %]
</ul>
[% END %]