From 58787923c838e5a1fc90d3f98e27a443bb1e1122 Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Wed, 30 Sep 2009 22:39:28 +0000 Subject: Bug 509053: Implement Bugzilla->feature (feature_enabled in the templates), and use it to detect when PatchReader is available. Patch by Max Kanat-Alexander r=LpSolit, a=LpSolit --- Bugzilla/Template.pm | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'Bugzilla') diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm index d6f665952..bea1639f3 100644 --- a/Bugzilla/Template.pm +++ b/Bugzilla/Template.pm @@ -281,12 +281,8 @@ sub get_attachment_link { # If the attachment is a patch, try to link to the diff rather # than the text, by default. my $patchlink = ""; - if ($is_patch) { - # Determine if PatchReader is installed - my $patchviewer_installed = eval { require PatchReader; }; - if ($patchviewer_installed) { - $patchlink = '&action=diff'; - } + if ($is_patch and Bugzilla->feature('patch_viewer')) { + $patchlink = '&action=diff'; } # Whitespace matters here because these links are in
 tags.
@@ -745,6 +741,8 @@ sub create {
                 return \@bug_list;
             },
 
+            'feature_enabled' => sub { return Bugzilla->feature(@_); },
+
             # These don't work as normal constants.
             DB_MODULE        => \&Bugzilla::Constants::DB_MODULE,
             REQUIRED_MODULES => 
-- 
cgit v1.2.1