summaryrefslogtreecommitdiff
path: root/app/controllers/groups_controller.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-02-18 00:16:42 -0800
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-02-18 00:16:42 -0800
commita8a328b1513c0aa442faaf8e8dd6f06f86ac3211 (patch)
tree1c4108e2a9c11058976a3ee07e172853f05df684 /app/controllers/groups_controller.rb
parent367d9a2dc683ef549905f35186412b5248376028 (diff)
downloadgitlab-ce-a8a328b1513c0aa442faaf8e8dd6f06f86ac3211.tar.gz
DB performance improvements to GitLab
Diffstat (limited to 'app/controllers/groups_controller.rb')
-rw-r--r--app/controllers/groups_controller.rb17
1 files changed, 11 insertions, 6 deletions
diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb
index aad3709090e..7b7531f1426 100644
--- a/app/controllers/groups_controller.rb
+++ b/app/controllers/groups_controller.rb
@@ -10,11 +10,11 @@ class GroupsController < ApplicationController
# Load group projects
before_filter :load_projects, except: [:new, :create, :projects, :edit, :update]
+ before_filter :event_filter, only: :show
+ before_filter :set_title, only: [:new, :create]
layout :determine_layout
- before_filter :set_title, only: [:new, :create]
-
def new
@group = Group.new
end
@@ -32,14 +32,19 @@ class GroupsController < ApplicationController
end
def show
- @events = Event.in_projects(project_ids)
- @events = event_filter.apply_filter(@events)
- @events = @events.limit(20).offset(params[:offset] || 0)
@last_push = current_user.recent_push if current_user
+ @projects = @projects.includes(:namespace)
respond_to do |format|
format.html
- format.json { pager_json("events/_events", @events.count) }
+
+ format.json do
+ @events = Event.in_projects(project_ids)
+ @events = event_filter.apply_filter(@events).includes(:target, project: :namespace)
+ @events = @events.limit(20).offset(params[:offset] || 0)
+ pager_json("events/_events", @events.count)
+ end
+
format.atom { render layout: false }
end
end