Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/users_controller.rb')
-rw-r--r--app/controllers/users_controller.rb18
1 files changed, 13 insertions, 5 deletions
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 68130eb128c..95ee9e83dbd 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -16,17 +16,16 @@ class UsersController < ApplicationController
# Collect only groups common for both users
@groups = @user.groups & GroupsFinder.new.execute(current_user)
- # Get user activity feed for projects common for both users
- @events = @user.recent_events.
- where(project_id: authorized_projects_ids).
- with_associations.limit(30)
-
@title = @user.name
@title_url = user_path(@user)
respond_to do |format|
format.html
format.atom { render layout: false }
+ format.json do
+ load_events
+ pager_json("events/_events", @events.count)
+ end
end
end
@@ -82,4 +81,13 @@ class UsersController < ApplicationController
@authorized_projects_ids ||=
ProjectsFinder.new.execute(current_user).pluck(:id)
end
+
+ def load_events
+ # Get user activity feed for projects common for both users
+ @events = @user.recent_events.
+ where(project_id: authorized_projects_ids).
+ with_associations
+
+ @events = @events.limit(20).offset(params[:offset] || 0)
+ end
end