Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
2ec2348af1c3
Commit
2395cd7e
authored
Feb 20, 2018
by
Andreas Brandl
Browse files
Avoid manual SQL for visibility level check.
parent
70abdfd2ccfc
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/models/project.rb
View file @
2ec2348a
...
...
@@ -342,7 +342,7 @@ def self.public_or_visible_to_user(user = nil, use_conditions_only: true, &block
authorized_projects
=
block
.
call
(
where
(
'EXISTS (?)'
,
authorized
))
levels
=
Gitlab
::
VisibilityLevel
.
levels_for_user
(
user
)
visible_projects
=
block
.
call
(
where
(
'
visibility_level
IN (?)'
,
levels
))
visible_projects
=
block
.
call
(
where
(
visibility_level
:
levels
))
# We use a UNION here instead of OR clauses since this results in better
# performance.
...
...
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