summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorMartin Wortschack <mwortschack@gitlab.com>2019-06-05 00:10:24 +0000
committerMayra Cabrera <mcabrera@gitlab.com>2019-06-05 00:10:24 +0000
commitdab00e6929412b7371a246ad37f858611b7f2757 (patch)
treee096293d5b5a1f0a332b4b7697e896e1041d3483 /app/controllers
parent54cc3b64929dfe2eea562089b5fd6656a50ed2ae (diff)
downloadgitlab-ce-dab00e6929412b7371a246ad37f858611b7f2757.tar.gz
Add render_projects method to controller
- Render EE specific partial if exists
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/dashboard/projects_controller.rb19
1 files changed, 13 insertions, 6 deletions
diff --git a/app/controllers/dashboard/projects_controller.rb b/app/controllers/dashboard/projects_controller.rb
index 70811f5ea59..65d14781d92 100644
--- a/app/controllers/dashboard/projects_controller.rb
+++ b/app/controllers/dashboard/projects_controller.rb
@@ -6,18 +6,14 @@ class Dashboard::ProjectsController < Dashboard::ApplicationController
prepend_before_action(only: [:index]) { authenticate_sessionless_user!(:rss) }
before_action :set_non_archived_param
+ before_action :projects, only: [:index]
before_action :default_sorting
skip_cross_project_access_check :index, :starred
def index
- @projects = load_projects(params.merge(non_public: true))
-
respond_to do |format|
format.html do
- # n+1: https://gitlab.com/gitlab-org/gitlab-ce/issues/40260
- Gitlab::GitalyClient.allow_n_plus_1_calls do
- render
- end
+ render_projects
end
format.atom do
load_events
@@ -51,6 +47,17 @@ class Dashboard::ProjectsController < Dashboard::ApplicationController
private
+ def projects
+ @projects ||= load_projects(params.merge(non_public: true))
+ end
+
+ def render_projects
+ # n+1: https://gitlab.com/gitlab-org/gitlab-ce/issues/40260
+ Gitlab::GitalyClient.allow_n_plus_1_calls do
+ render
+ end
+ end
+
def default_sorting
params[:sort] ||= 'latest_activity_desc'
@sort = params[:sort]