Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
6a6ffbe1
Commit
6a6ffbe1
authored
Feb 18, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix user page performance and authorization
Conflicts: app/models/user.rb
parent
0fbf5e13
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
7 deletions
+10
-7
app/controllers/users_controller.rb
app/controllers/users_controller.rb
+10
-7
No files found.
app/controllers/users_controller.rb
View file @
6a6ffbe1
...
...
@@ -4,11 +4,8 @@ class UsersController < ApplicationController
layout
:determine_layout
def
show
# Projects user can view
visible_projects
=
ProjectsFinder
.
new
.
execute
(
current_user
)
authorized_projects_ids
=
visible_projects
.
pluck
(
:id
)
@contributed_projects
=
Project
.
where
(
id:
authorized_projects_ids
).
@contributed_projects
=
Project
.
where
(
id:
authorized_projects_ids
&
@user
.
contributed_projects_ids
).
in_group_namespace
.
includes
(
:namespace
)
@projects
=
@user
.
personal_projects
.
...
...
@@ -32,8 +29,8 @@ class UsersController < ApplicationController
end
def
calendar
visible_projects
=
ProjectsFinder
.
new
.
execute
(
current_user
)
calendar
=
Gitlab
::
CommitsCalendar
.
new
(
visible_
projects
,
@user
)
projects
=
Project
.
where
(
id:
authorized_projects_ids
&
@user
.
contributed_projects_ids
)
calendar
=
Gitlab
::
CommitsCalendar
.
new
(
projects
,
@user
)
@timestamps
=
calendar
.
timestamps
@starting_year
=
calendar
.
starting_year
@starting_month
=
calendar
.
starting_month
...
...
@@ -58,4 +55,10 @@ class UsersController < ApplicationController
return
authenticate_user!
end
end
def
authorized_projects_ids
# Projects user can view
@authorized_projects_ids
||=
ProjectsFinder
.
new
.
execute
(
current_user
).
pluck
(
:id
)
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment