summaryrefslogtreecommitdiff
path: root/app/helpers
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2017-10-11 16:48:43 +0100
committerSean McGivern <sean@gitlab.com>2017-10-12 13:26:03 +0100
commitb7303b65b1a761c7ad7ed9eed993ad55fcecb953 (patch)
treee1d7048be0f5994d9750b5c8b86c384291a0c459 /app/helpers
parent218e1f0963768fced0ed9a33762253c273c72069 (diff)
downloadgitlab-ce-b7303b65b1a761c7ad7ed9eed993ad55fcecb953.tar.gz
Cache issuable template names
We were looking these up on each request to an issue page, because the form is pre-filled, as is the template dropdown. That was unnecessary: we could just treat these as 'special' repository files (like the rendered README) and cache them in Redis until they change on a push.
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/issuables_helper.rb12
1 files changed, 2 insertions, 10 deletions
diff --git a/app/helpers/issuables_helper.rb b/app/helpers/issuables_helper.rb
index 7713fb0b9f8..baa2d6e375e 100644
--- a/app/helpers/issuables_helper.rb
+++ b/app/helpers/issuables_helper.rb
@@ -314,20 +314,12 @@ module IssuablesHelper
@issuable_templates ||=
case issuable
when Issue
- issue_template_names
+ ref_project.repository.issue_template_names
when MergeRequest
- merge_request_template_names
+ ref_project.repository.merge_request_template_names
end
end
- def merge_request_template_names
- @merge_request_templates ||= Gitlab::Template::MergeRequestTemplate.dropdown_names(ref_project)
- end
-
- def issue_template_names
- @issue_templates ||= Gitlab::Template::IssueTemplate.dropdown_names(ref_project)
- end
-
def selected_template(issuable)
params[:issuable_template] if issuable_templates(issuable).any? { |template| template[:name] == params[:issuable_template] }
end