summaryrefslogtreecommitdiffstats
path: root/extensions
diff options
context:
space:
mode:
authorSebastin Santy <sebastinssanty@gmail.com>2017-03-15 21:19:05 +0100
committerDylan William Hardison <dylan@hardison.net>2017-03-15 21:20:17 +0100
commitd7dacb94bd6fd26f80b1a7932a043a3d2219be79 (patch)
treeeca584840c50000928c0904ef0a3641614e97df2 /extensions
parent4da65f234a74e4c8c2d2ec9bd20e812175787194 (diff)
downloadbugzilla-d7dacb94bd6fd26f80b1a7932a043a3d2219be79.tar.gz
bugzilla-d7dacb94bd6fd26f80b1a7932a043a3d2219be79.tar.xz
Bug 1309112 - Detect and linkify GitHub issue in comment
Diffstat (limited to 'extensions')
-rw-r--r--extensions/BMO/Extension.pm12
1 files changed, 12 insertions, 0 deletions
diff --git a/extensions/BMO/Extension.pm b/extensions/BMO/Extension.pm
index 8412a2518..1640bd076 100644
--- a/extensions/BMO/Extension.pm
+++ b/extensions/BMO/Extension.pm
@@ -720,6 +720,18 @@ sub bug_format_comment {
}
});
+ # link github pull requests and issues
+ push (@$regexes, {
+ match => qr/(\s)([A-Za-z0-9_\.-]+)\/([A-Za-z0-9_\.-]+)\#([0-9]+)\b/,
+ replace => sub {
+ my $args = shift;
+ my $owner = html_quote($args->{matches}->[1]);
+ my $repo = html_quote($args->{matches}->[2]);
+ my $number = html_quote($args->{matches}->[3]);
+ return qq# <a href="https://github.com/$owner/$repo/issues/$number">$owner/$repo\#$number</a>#;
+ }
+ });
+
# Update certain links to git.mozilla.org to go to github.com instead
# https://git.mozilla.org/?p=webtools/bmo/bugzilla.git;a=blob;f=Bugzilla/WebService/Bug.pm;h=d7a1d8f9bb5fdee524f2bb342a4573a63d890f2e;hb=HEAD#l657
push(@$regexes, {