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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
b0de6e9a
Commit
b0de6e9a
authored
Jun 09, 2015
by
zenati
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
An `in_namespace` scope is already present
parent
9562f028
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
11 additions
and
9 deletions
+11
-9
app/controllers/admin/projects_controller.rb
app/controllers/admin/projects_controller.rb
+1
-1
app/models/project.rb
app/models/project.rb
+1
-1
app/models/user.rb
app/models/user.rb
+5
-3
app/services/search/global_service.rb
app/services/search/global_service.rb
+1
-1
lib/tasks/gitlab/cleanup.rake
lib/tasks/gitlab/cleanup.rake
+1
-1
lib/tasks/gitlab/web_hook.rake
lib/tasks/gitlab/web_hook.rake
+2
-2
No files found.
app/controllers/admin/projects_controller.rb
View file @
b0de6e9a
...
...
@@ -5,7 +5,7 @@ class Admin::ProjectsController < Admin::ApplicationController
def
index
@projects
=
Project
.
all
@projects
=
@projects
.
where
(
namespace_id:
params
[
:namespace_id
])
if
params
[
:namespace_id
].
present?
@projects
=
@projects
.
in_namespace
(
params
[
:namespace_id
])
if
params
[
:namespace_id
].
present?
@projects
=
@projects
.
where
(
"visibility_level IN (?)"
,
params
[
:visibility_levels
])
if
params
[
:visibility_levels
].
present?
@projects
=
@projects
.
with_push
if
params
[
:with_push
].
present?
@projects
=
@projects
.
abandoned
if
params
[
:abandoned
].
present?
...
...
app/models/project.rb
View file @
b0de6e9a
...
...
@@ -158,7 +158,7 @@ class Project < ActiveRecord::Base
scope
:without_user
,
->
(
user
)
{
where
(
'projects.id NOT IN (:ids)'
,
ids:
user
.
authorized_projects
.
map
(
&
:id
)
)
}
scope
:without_team
,
->
(
team
)
{
team
.
projects
.
present?
?
where
(
'projects.id NOT IN (:ids)'
,
ids:
team
.
projects
.
map
(
&
:id
))
:
scoped
}
scope
:not_in_group
,
->
(
group
)
{
where
(
'projects.id NOT IN (:ids)'
,
ids:
group
.
project_ids
)
}
scope
:in_namespace
,
->
(
namespace
)
{
where
(
namespace_id:
namespace
.
id
)
}
scope
:in_namespace
,
->
(
namespace
_ids
)
{
where
(
namespace_id:
namespace_ids
)
}
scope
:in_group_namespace
,
->
{
joins
(
:group
)
}
scope
:personal
,
->
(
user
)
{
where
(
namespace_id:
user
.
namespace_id
)
}
scope
:joined
,
->
(
user
)
{
where
(
'namespace_id != ?'
,
user
.
namespace_id
)
}
...
...
app/models/user.rb
View file @
b0de6e9a
...
...
@@ -352,9 +352,11 @@ class User < ActiveRecord::Base
end
def
owned_projects
@owned_projects
||=
begin
Project
.
where
(
namespace_id:
owned_groups
.
pluck
(
:id
).
push
(
namespace
.
id
)).
joins
(
:namespace
)
end
@owned_projects
||=
begin
namespace_ids
=
owned_groups
.
pluck
(
:id
).
push
(
namespace
.
id
)
Project
.
in_namespace
(
namespace_ids
).
joins
(
:namespace
)
end
end
# Team membership in authorized projects
...
...
app/services/search/global_service.rb
View file @
b0de6e9a
...
...
@@ -9,7 +9,7 @@ module Search
def
execute
group
=
Group
.
find_by
(
id:
params
[
:group_id
])
if
params
[
:group_id
].
present?
projects
=
ProjectsFinder
.
new
.
execute
(
current_user
)
projects
=
projects
.
where
(
namespace_id:
group
.
id
)
if
group
projects
=
projects
.
in_namespace
(
group
.
id
)
if
group
project_ids
=
projects
.
pluck
(
:id
)
Gitlab
::
SearchResults
.
new
(
project_ids
,
params
[
:search
])
...
...
lib/tasks/gitlab/cleanup.rake
View file @
b0de6e9a
...
...
@@ -51,7 +51,7 @@ namespace :gitlab do
git_base_path
=
Gitlab
.
config
.
gitlab_shell
.
repos_path
all_dirs
=
Dir
.
glob
(
git_base_path
+
'/*'
)
global_projects
=
Project
.
where
(
namespace_id:
nil
).
pluck
(
:path
)
global_projects
=
Project
.
in_namespace
(
nil
).
pluck
(
:path
)
puts
git_base_path
.
yellow
puts
"Looking for global repos to remove... "
...
...
lib/tasks/gitlab/web_hook.rake
View file @
b0de6e9a
...
...
@@ -51,11 +51,11 @@ namespace :gitlab do
if
namespace_path
.
blank?
Project
elsif
namespace_path
==
'/'
Project
.
where
(
namespace_id:
nil
)
Project
.
in_namespace
(
nil
)
else
namespace
=
Namespace
.
where
(
path:
namespace_path
).
first
if
namespace
Project
.
where
(
namespace_id:
namespace
.
id
)
Project
.
in_namespace
(
namespace
.
id
)
else
puts
"Namespace not found:
#{
namespace_path
}
"
.
red
exit
2
...
...
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