diff options
author | Dave Lawrence <dlawrence@mozilla.com> | 2012-03-06 18:05:35 +0100 |
---|---|---|
committer | Dave Lawrence <dlawrence@mozilla.com> | 2012-03-06 18:05:35 +0100 |
commit | 2bea3e2abd44e07198199eb9ac86aebc4c3f0f2a (patch) | |
tree | ef462db8ce5b5140f3b644c2bf82891772e249f9 /Bugzilla | |
parent | 22114cb2da0ec6e9939d0d03b4714d74b7cad71f (diff) | |
download | bugzilla-2bea3e2abd44e07198199eb9ac86aebc4c3f0f2a.tar.gz bugzilla-2bea3e2abd44e07198199eb9ac86aebc4c3f0f2a.tar.xz |
Bug 732189 - Backport 731562 to bmo: Cache the global/user.html.tmpl template, r=glob
https://bugzilla.mozilla.org/show_bug.cgi?id=731562
Diffstat (limited to 'Bugzilla')
-rw-r--r-- | Bugzilla/Template.pm | 10 | ||||
-rw-r--r-- | Bugzilla/User.pm | 9 |
2 files changed, 18 insertions, 1 deletions
diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm index a1a6944f0..f069b19d2 100644 --- a/Bugzilla/Template.pm +++ b/Bugzilla/Template.pm @@ -938,7 +938,15 @@ sub create { Bugzilla->fields({ by_name => 1 }); return $cache->{template_bug_fields}; }, - + + # A general purpose cache to store rendered templates for reuse. + # Make sure to not mix language-specific data. + 'template_cache' => sub { + my $cache = Bugzilla->request_cache->{template_cache} ||= {}; + $cache->{users} ||= {}; + return $cache; + }, + 'css_files' => \&css_files, yui_resolve_deps => \&yui_resolve_deps, diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm index d6e343429..e9d2754f7 100644 --- a/Bugzilla/User.pm +++ b/Bugzilla/User.pm @@ -779,6 +779,15 @@ sub in_group_id { return grep($_->id == $id, @{ $self->groups }) ? 1 : 0; } +# This is a helper to get all groups which have an icon to be displayed +# besides the name of the commenter. +sub groups_with_icon { + my $self = shift; + + my @groups = grep { $_->icon_url } @{ $self->direct_group_membership }; + return \@groups; +} + sub get_products_by_permission { my ($self, $group) = @_; # Make sure $group exists on a per-product basis. |