Dzahn has submitted this change and it was merged.

Change subject: Add support for Wikimedia RT URLs to Bugzilla's 'See Also' 
field.
......................................................................


Add support for Wikimedia RT URLs to Bugzilla's 'See Also' field.

bug: 45589
Change-Id: Ideb3b0890e625e488768d07a826f230e605723b6
---
M bugzilla-4.2/Bugzilla/BugUrl.pm
A bugzilla-4.2/Bugzilla/BugUrl/RequestTracker.pm
M bugzilla-4.2/template/en/custom/global/user-error.html.tmpl
3 files changed, 48 insertions(+), 0 deletions(-)

Approvals:
  Dzahn: Verified; Looks good to me, approved



diff --git a/bugzilla-4.2/Bugzilla/BugUrl.pm b/bugzilla-4.2/Bugzilla/BugUrl.pm
index 7846009..758c5f9 100644
--- a/bugzilla-4.2/Bugzilla/BugUrl.pm
+++ b/bugzilla-4.2/Bugzilla/BugUrl.pm
@@ -70,6 +70,7 @@
     Bugzilla::BugUrl::MantisBT
     Bugzilla::BugUrl::SourceForge
     Bugzilla::BugUrl::GitHub
+    Bugzilla::BugUrl::RequestTracker
 );
 
 ###############################
diff --git a/bugzilla-4.2/Bugzilla/BugUrl/RequestTracker.pm 
b/bugzilla-4.2/Bugzilla/BugUrl/RequestTracker.pm
new file mode 100644
index 0000000..7995c40
--- /dev/null
+++ b/bugzilla-4.2/Bugzilla/BugUrl/RequestTracker.pm
@@ -0,0 +1,46 @@
+# -*- Mode: perl; indent-tabs-mode: nil -*-
+#
+# The contents of this file are subject to the Mozilla Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code is the Bugzilla Bug Tracking System.
+#
+# Contributor(s): Andre Klapper <ak...@gmx.net>
+
+package Bugzilla::BugUrl::RequestTracker;
+use strict;
+use base qw(Bugzilla::BugUrl);
+
+use Bugzilla::Error;
+use Bugzilla::Util;
+
+###############################
+####        Methods        ####
+###############################
+
+sub should_handle {
+    my ($class, $uri) = @_;
+    # RT URLs have this form:
+    #   http[s]://rt.wikimedia.org/Ticket/Display.html?id=12345
+    return (lc($uri->authority) eq 'rt.wikimedia.org'
+           and $uri->path =~ m|^/Ticket/Display\.html$|
+           and $uri->query_param('id') =~ /^\d+$/) ? 1 : 0;
+}
+
+sub _check_value {
+    my $class = shift;
+
+    my $uri = $class->SUPER::_check_value(@_);
+    # Always make the link https:
+    $uri->scheme('https');
+    return $uri;
+}
+
+1;
diff --git a/bugzilla-4.2/template/en/custom/global/user-error.html.tmpl 
b/bugzilla-4.2/template/en/custom/global/user-error.html.tmpl
index fa605b9..8d8d9bb 100644
--- a/bugzilla-4.2/template/en/custom/global/user-error.html.tmpl
+++ b/bugzilla-4.2/template/en/custom/global/user-error.html.tmpl
@@ -271,6 +271,7 @@
         <li>A b[% %]ug in a MantisBT installation.</li>
         <li>A b[% %]ug on sourceforge.net.</li>
         <li>An issue on github.com.</li>
+        <li>A ticket in rt.wikimedia.org.</li>
       </ul>
     [% ELSIF reason == 'id' %]
       There is no valid [% terms.bug %] id in that URL.

-- 
To view, visit https://gerrit.wikimedia.org/r/59856
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ideb3b0890e625e488768d07a826f230e605723b6
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/bugzilla/modifications
Gerrit-Branch: master
Gerrit-Owner: Aklapper <aklap...@wikimedia.org>
Gerrit-Reviewer: Dzahn <dz...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to