diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-09-23 16:30:24 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-09-23 16:30:24 +0300 |
commit | 31b15e3dce2817d8cd6d70cda97c6b9dbf5c7f8a (patch) | |
tree | 704788a66dc2ba75baba94c28a7f012aa70f32f9 /app/controllers/ci | |
parent | 0731a7af319e4c19e98a43b7355fa26f5e8bd6f5 (diff) |
Simplify CI projects query
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/controllers/ci')
-rw-r--r-- | app/controllers/ci/projects_controller.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/app/controllers/ci/projects_controller.rb b/app/controllers/ci/projects_controller.rb index e480c0be907..6b7545e5447 100644 --- a/app/controllers/ci/projects_controller.rb +++ b/app/controllers/ci/projects_controller.rb @@ -16,12 +16,15 @@ module Ci end def index + @projects = Ci::Project.all + if current_user - @projects = ProjectListBuilder.new.execute(current_user, params[:search]) - @projects = @projects.page(params[:page]).per(40) - @total_count = @projects.size + @projects = @projects.where(gitlab_id: current_user.authorized_projects.pluck(:id)) end + @projects = @projects.includes(:last_commit).order('ci_commits.created_at DESC') + @projects = @projects.page(params[:page]).per(40) + respond_to do |format| format.json do pager_json("ci/projects/index", @total_count) |