From 2bea3e2abd44e07198199eb9ac86aebc4c3f0f2a Mon Sep 17 00:00:00 2001 From: Dave Lawrence Date: Tue, 6 Mar 2012 12:05:35 -0500 Subject: Bug 732189 - Backport 731562 to bmo: Cache the global/user.html.tmpl template, r=glob https://bugzilla.mozilla.org/show_bug.cgi?id=731562 --- template/en/default/attachment/list.html.tmpl | 10 +++++++++- template/en/default/bug/comments.html.tmpl | 16 +++++++++++----- 2 files changed, 20 insertions(+), 6 deletions(-) (limited to 'template/en') diff --git a/template/en/default/attachment/list.html.tmpl b/template/en/default/attachment/list.html.tmpl index fa8e4774e..5079a0eec 100644 --- a/template/en/default/attachment/list.html.tmpl +++ b/template/en/default/attachment/list.html.tmpl @@ -64,6 +64,7 @@ function toggle_display(link) { [% count = 0 %] [% obsolete_attachments = 0 %] + [% user_cache = template_cache.users %] [% FOREACH attachment = attachments %] [% count = count + 1 %] @@ -102,7 +103,14 @@ function toggle_display(link) { title="Go to the comment associated with the attachment"> [%- attachment.attached FILTER time %], - [% INCLUDE global/user.html.tmpl who = attachment.attacher %] + [%# No need to recreate the exact same template if we already have it. %] + [% attacher_id = attachment.attacher.id %] + [% UNLESS user_cache.$attacher_id %] + [% user_cache.$attacher_id = BLOCK %] + [% INCLUDE global/user.html.tmpl who = attachment.attacher %] + [% END %] + [% END %] + [% user_cache.$attacher_id FILTER none %] diff --git a/template/en/default/bug/comments.html.tmpl b/template/en/default/bug/comments.html.tmpl index 2a00b47ec..3c303afb8 100644 --- a/template/en/default/bug/comments.html.tmpl +++ b/template/en/default/bug/comments.html.tmpl @@ -63,6 +63,7 @@ [% DEFAULT start_at = 0 mode = "show" %] [% sort_order = user.settings.comment_sort_order.value %] +[% user_cache = template_cache.users %] [%# NOTE: (start_at > 0) means we came here from a midair collision, # in which case we don't care what the user's preference is. @@ -176,13 +177,18 @@ - [% INCLUDE global/user.html.tmpl who = comment.author %] - [% Hook.process('user', 'bug/comments.html.tmpl') %] - + [%# No need to recreate the exact same template if we already have it. %] + [% commenter_id = comment.author.id %] + [% UNLESS user_cache.$commenter_id %] + [% user_cache.$commenter_id = BLOCK %] + [% INCLUDE global/user.html.tmpl who = comment.author %] + [% END %] + [% END %] + [% user_cache.$commenter_id FILTER none %] + - [% FOREACH group = comment.author.direct_group_membership %] - [% NEXT UNLESS group.icon_url %] + [% FOREACH group = comment.author.groups_with_icon %] [% group.name FILTER html %] -- cgit v1.2.3-24-g4f1b