summaryrefslogtreecommitdiff
path: root/app/services/test_hooks
diff options
context:
space:
mode:
authorFrancisco Javier López <fjlopez@gitlab.com>2019-04-25 04:19:07 +0000
committerStan Hu <stanhu@gmail.com>2019-04-25 04:19:07 +0000
commitdde69bfb2a595956c54ddb9c776759c11b3f2a3b (patch)
tree70629de9baf0f34a2bf2bc71e9045bc0366ec24c /app/services/test_hooks
parent0f863c68bb8bc5054a22e0c553a933c83bea4df6 (diff)
downloadgitlab-ce-dde69bfb2a595956c54ddb9c776759c11b3f2a3b.tar.gz
Added list_pages method to avoid loading all wiki pages content
Inside a wiki, when we show the sidebar or browse to the `pages`, all page contents are retrieved from Gitaly and that is a waste of resources, since no content from that pages are going to be showed. This MR introduces the method `ProjectWiki#list_pages`, which uses new wiki_list_pages RPC call to retrieve pages without content Also in the `WikisController` we're using the method to show pages in the sidebar and also on the `pages` page.
Diffstat (limited to 'app/services/test_hooks')
-rw-r--r--app/services/test_hooks/project_service.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/services/test_hooks/project_service.rb b/app/services/test_hooks/project_service.rb
index 6607f5b2418..a71278e8b8b 100644
--- a/app/services/test_hooks/project_service.rb
+++ b/app/services/test_hooks/project_service.rb
@@ -56,7 +56,7 @@ module TestHooks
end
def wiki_page_events_data
- page = project.wiki.pages.first
+ page = project.wiki.list_pages(limit: 1).first
if !project.wiki_enabled? || page.blank?
throw(:validation_error, s_('TestHooks|Ensure the wiki is enabled and has pages.'))
end