summaryrefslogtreecommitdiff
path: root/app/controllers/projects/wikis_controller.rb
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-07-21 23:48:12 -0700
committerStan Hu <stanhu@gmail.com>2018-07-24 15:36:31 -0700
commitc8ff6b7c73ccf42e70f7fd4675dd7f68d03739c1 (patch)
tree9a12252e2d2b6b1e0ce55df26f63eeed31a3452c /app/controllers/projects/wikis_controller.rb
parentc06e2ac888fb5180cdf133df89d03b99eceafa0d (diff)
downloadgitlab-ce-c8ff6b7c73ccf42e70f7fd4675dd7f68d03739c1.tar.gz
Use limit parameter to retrieve Wikis from Gitalysh-use-wiki-limit-parameter-gitaly
Without this parameter, every load of a Wiki page will load all the Wiki pages in the repository for the sidebar. This is a significant performance penalty that can significant slow the display of all Wiki pages. Relates to #40101
Diffstat (limited to 'app/controllers/projects/wikis_controller.rb')
-rw-r--r--app/controllers/projects/wikis_controller.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/controllers/projects/wikis_controller.rb b/app/controllers/projects/wikis_controller.rb
index 9dc0c31be49..b7c656246ef 100644
--- a/app/controllers/projects/wikis_controller.rb
+++ b/app/controllers/projects/wikis_controller.rb
@@ -112,7 +112,7 @@ class Projects::WikisController < Projects::ApplicationController
private
def load_project_wiki
- @project_wiki = ProjectWiki.new(@project, current_user)
+ @project_wiki = load_wiki
# Call #wiki to make sure the Wiki Repo is initialized
@project_wiki.wiki
@@ -128,6 +128,10 @@ class Projects::WikisController < Projects::ApplicationController
false
end
+ def load_wiki
+ ProjectWiki.new(@project, current_user)
+ end
+
def wiki_params
params.require(:wiki).permit(:title, :content, :format, :message, :last_commit_sha)
end