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
Show 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
...
@@ -5,7 +5,7 @@ class Admin::ProjectsController < Admin::ApplicationController
def
index
def
index
@projects
=
Project
.
all
@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
.
where
(
"visibility_level IN (?)"
,
params
[
:visibility_levels
])
if
params
[
:visibility_levels
].
present?
@projects
=
@projects
.
with_push
if
params
[
:with_push
].
present?
@projects
=
@projects
.
with_push
if
params
[
:with_push
].
present?
@projects
=
@projects
.
abandoned
if
params
[
:abandoned
].
present?
@projects
=
@projects
.
abandoned
if
params
[
:abandoned
].
present?
...
...
app/models/project.rb
View file @
b0de6e9a
...
@@ -158,7 +158,7 @@ class Project < ActiveRecord::Base
...
@@ -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_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
: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
: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
:in_group_namespace
,
->
{
joins
(
:group
)
}
scope
:personal
,
->
(
user
)
{
where
(
namespace_id:
user
.
namespace_id
)
}
scope
:personal
,
->
(
user
)
{
where
(
namespace_id:
user
.
namespace_id
)
}
scope
:joined
,
->
(
user
)
{
where
(
'namespace_id != ?'
,
user
.
namespace_id
)
}
scope
:joined
,
->
(
user
)
{
where
(
'namespace_id != ?'
,
user
.
namespace_id
)
}
...
...
app/models/user.rb
View file @
b0de6e9a
...
@@ -352,8 +352,10 @@ class User < ActiveRecord::Base
...
@@ -352,8 +352,10 @@ class User < ActiveRecord::Base
end
end
def
owned_projects
def
owned_projects
@owned_projects
||=
begin
@owned_projects
||=
Project
.
where
(
namespace_id:
owned_groups
.
pluck
(
:id
).
push
(
namespace
.
id
)).
joins
(
:namespace
)
begin
namespace_ids
=
owned_groups
.
pluck
(
:id
).
push
(
namespace
.
id
)
Project
.
in_namespace
(
namespace_ids
).
joins
(
:namespace
)
end
end
end
end
...
...
app/services/search/global_service.rb
View file @
b0de6e9a
...
@@ -9,7 +9,7 @@ module Search
...
@@ -9,7 +9,7 @@ module Search
def
execute
def
execute
group
=
Group
.
find_by
(
id:
params
[
:group_id
])
if
params
[
:group_id
].
present?
group
=
Group
.
find_by
(
id:
params
[
:group_id
])
if
params
[
:group_id
].
present?
projects
=
ProjectsFinder
.
new
.
execute
(
current_user
)
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
)
project_ids
=
projects
.
pluck
(
:id
)
Gitlab
::
SearchResults
.
new
(
project_ids
,
params
[
:search
])
Gitlab
::
SearchResults
.
new
(
project_ids
,
params
[
:search
])
...
...
lib/tasks/gitlab/cleanup.rake
View file @
b0de6e9a
...
@@ -51,7 +51,7 @@ namespace :gitlab do
...
@@ -51,7 +51,7 @@ namespace :gitlab do
git_base_path
=
Gitlab
.
config
.
gitlab_shell
.
repos_path
git_base_path
=
Gitlab
.
config
.
gitlab_shell
.
repos_path
all_dirs
=
Dir
.
glob
(
git_base_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
git_base_path
.
yellow
puts
"Looking for global repos to remove... "
puts
"Looking for global repos to remove... "
...
...
lib/tasks/gitlab/web_hook.rake
View file @
b0de6e9a
...
@@ -51,11 +51,11 @@ namespace :gitlab do
...
@@ -51,11 +51,11 @@ namespace :gitlab do
if
namespace_path
.
blank?
if
namespace_path
.
blank?
Project
Project
elsif
namespace_path
==
'/'
elsif
namespace_path
==
'/'
Project
.
where
(
namespace_id:
nil
)
Project
.
in_namespace
(
nil
)
else
else
namespace
=
Namespace
.
where
(
path:
namespace_path
).
first
namespace
=
Namespace
.
where
(
path:
namespace_path
).
first
if
namespace
if
namespace
Project
.
where
(
namespace_id:
namespace
.
id
)
Project
.
in_namespace
(
namespace
.
id
)
else
else
puts
"Namespace not found:
#{
namespace_path
}
"
.
red
puts
"Namespace not found:
#{
namespace_path
}
"
.
red
exit
2
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