summaryrefslogtreecommitdiff
path: root/app/models/repository.rb
diff options
context:
space:
mode:
authorMike Greiling <mike@pixelcog.com>2017-10-12 17:52:09 -0500
committerMike Greiling <mike@pixelcog.com>2017-10-12 17:52:09 -0500
commit53e11239ce9e7f9513c890a78df41c611bcc2ae1 (patch)
tree08300d49b78dff43f95e52cc298fa8732b9a32a9 /app/models/repository.rb
parentd8cc4540ab83c98a09b11d1654fac593c47384c8 (diff)
parent8d47e9f8e13c2ca43520b348dde0424fe6460cc9 (diff)
downloadgitlab-ce-53e11239ce9e7f9513c890a78df41c611bcc2ae1.tar.gz
Merge branch 'master' into sh-headless-chrome-support
* master: (104 commits) Update licenses fix a wrong method call in the refactor fix a whitespace fix for discussion Update templates via: Update doc accordingly to: Cache issuable template names Fix the format of rugged alternate directory list Match full file path in FileDetector Fixes from CSS refactor Resolve "Prometheus service page shows error" Explicit state integration deletion Move all API authentication code to APIGuard Shorten example translation for inclusive language [ci-skip] add changelog fix the merger override to remove source branch add spec Removed d3.js from the users and graphs bundle Cleanup data-page attribute after each Karma test Update template description wording ...
Diffstat (limited to 'app/models/repository.rb')
-rw-r--r--app/models/repository.rb17
1 files changed, 15 insertions, 2 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index d725c65081d..bf526ca1762 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -34,7 +34,8 @@ class Repository
CACHED_METHODS = %i(size commit_count rendered_readme contribution_guide
changelog license_blob license_key gitignore koding_yml
gitlab_ci_yml branch_names tag_names branch_count
- tag_count avatar exists? empty? root_ref has_visible_content?).freeze
+ tag_count avatar exists? empty? root_ref has_visible_content?
+ issue_template_names merge_request_template_names).freeze
# Methods that use cache_method but only memoize the value
MEMOIZED_CACHED_METHODS = %i(license empty_repo?).freeze
@@ -50,7 +51,9 @@ class Repository
gitignore: :gitignore,
koding: :koding_yml,
gitlab_ci: :gitlab_ci_yml,
- avatar: :avatar
+ avatar: :avatar,
+ issue_template: :issue_template_names,
+ merge_request_template: :merge_request_template_names
}.freeze
# Wraps around the given method and caches its output in Redis and an instance
@@ -535,6 +538,16 @@ class Repository
end
cache_method :avatar
+ def issue_template_names
+ Gitlab::Template::IssueTemplate.dropdown_names(project)
+ end
+ cache_method :issue_template_names, fallback: []
+
+ def merge_request_template_names
+ Gitlab::Template::MergeRequestTemplate.dropdown_names(project)
+ end
+ cache_method :merge_request_template_names, fallback: []
+
def readme
if readme = tree(:head)&.readme
ReadmeBlob.new(readme, self)