Skip to content

Commit

Permalink
Bug 1752107 - Allow adding Reddit threads to "See Also"
Browse files Browse the repository at this point in the history
  • Loading branch information
dklawren committed Mar 11, 2022
1 parent 91d0130 commit 42c7cf9
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions Bugzilla/BugUrl.pm
Expand Up @@ -75,6 +75,7 @@ use constant SUB_CLASSES => qw(
Bugzilla::BugUrl::Splat
Bugzilla::BugUrl::Phabricator
Bugzilla::BugUrl::ConnectMozOrg
Bugzilla::BugUrl::Reddit
);

###############################
Expand Down
32 changes: 32 additions & 0 deletions Bugzilla/BugUrl/Reddit.pm
@@ -0,0 +1,32 @@
# 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::Reddit;

use 5.10.1;
use strict;
use warnings;

use base qw(Bugzilla::BugUrl);

###############################
#### Methods ####
###############################

sub should_handle {
my ($class, $uri) = @_;
return (lc($uri->authority) eq 'www.reddit.com'
and $uri->path =~ /^\/r\//) ? 1 : 0;
}

sub _check_value {
my ($class, $uri) = @_;
$uri = $class->SUPER::_check_value($uri);
return $uri;
}

1;
1 change: 1 addition & 0 deletions template/en/default/global/user-error.html.tmpl
Expand Up @@ -340,6 +340,7 @@
<li>A revision, support ticket, or task in Phabricator.</li>
<li>A Mozilla Sentry issue.</li>
<li>An idea or discussion topic on connect.mozilla.org</li>
<li>A discussion topic on www.reddit.com</li>
</ul>
[% ELSIF reason == 'id' %]
There is no valid [% terms.bug %] id in that URL.
Expand Down

0 comments on commit 42c7cf9

Please sign in to comment.