diff options
author | Eugene Howe <eugene@xtreme-computers.net> | 2016-07-17 17:32:11 +0300 |
---|---|---|
committer | Eugene Howe <eugene@xtreme-computers.net> | 2016-07-19 16:06:58 +0300 |
commit | 13e74543f9d0f91b7b3ef14279fd78d83f442750 (patch) | |
tree | 2113950412eb9a83d3f0bc5bdc1aaee60661e06c /app/helpers | |
parent | 61e7453e0465ceb631d3e8445429cfed7c1449d3 (diff) |
speed up ExternalWikiService#get_project_wiki_path
* This method previously iterated over all services in a project. Now it
will directly query the ExternalWikiService for the project and filter
by active state.
* The presence of an external wiki is also cached
* When an external wiki is added or removed, the cached value is updated
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/external_wiki_helper.rb | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/app/helpers/external_wiki_helper.rb b/app/helpers/external_wiki_helper.rb index 1f3401f2906..defd87d6bbe 100644 --- a/app/helpers/external_wiki_helper.rb +++ b/app/helpers/external_wiki_helper.rb @@ -1,8 +1,7 @@ module ExternalWikiHelper def get_project_wiki_path(project) - external_wiki_service = project.services. - find { |service| service.to_param == 'external_wiki' } - if external_wiki_service.present? && external_wiki_service.active? + external_wiki_service = project.external_wiki + if external_wiki_service external_wiki_service.properties['external_wiki_url'] else namespace_project_wiki_path(project.namespace, project, :home) |