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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
1fbb7f97
Commit
1fbb7f97
authored
Jun 19, 2017
by
Tiago Botelho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removes redundant pending delete checks
parent
34f57b46
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
10 additions
and
27 deletions
+10
-27
app/finders/todos_finder.rb
app/finders/todos_finder.rb
+1
-2
app/helpers/search_helper.rb
app/helpers/search_helper.rb
+2
-2
app/models/namespace.rb
app/models/namespace.rb
+2
-0
app/models/project.rb
app/models/project.rb
+2
-3
app/services/ci/register_job_service.rb
app/services/ci/register_job_service.rb
+3
-3
spec/features/dashboard/todos/todos_spec.rb
spec/features/dashboard/todos/todos_spec.rb
+0
-17
No files found.
app/finders/todos_finder.rb
View file @
1fbb7f97
...
@@ -78,7 +78,6 @@ class TodosFinder
...
@@ -78,7 +78,6 @@ class TodosFinder
end
end
def
project
def
project
return
nil
if
@project
&
.
pending_delete?
return
@project
if
defined?
(
@project
)
return
@project
if
defined?
(
@project
)
if
project?
if
project?
...
@@ -98,7 +97,7 @@ class TodosFinder
...
@@ -98,7 +97,7 @@ class TodosFinder
def
projects
(
items
)
def
projects
(
items
)
item_project_ids
=
items
.
reorder
(
nil
).
select
(
:project_id
)
item_project_ids
=
items
.
reorder
(
nil
).
select
(
:project_id
)
ProjectsFinder
.
new
(
current_user:
current_user
,
project_ids_relation:
item_project_ids
).
execute
.
without_deleted
ProjectsFinder
.
new
(
current_user:
current_user
,
project_ids_relation:
item_project_ids
).
execute
end
end
def
type?
def
type?
...
...
app/helpers/search_helper.rb
View file @
1fbb7f97
...
@@ -97,8 +97,8 @@ module SearchHelper
...
@@ -97,8 +97,8 @@ module SearchHelper
# Autocomplete results for the current user's projects
# Autocomplete results for the current user's projects
def
projects_autocomplete
(
term
,
limit
=
5
)
def
projects_autocomplete
(
term
,
limit
=
5
)
current_user
.
authorized_projects
.
search_by_title
(
term
)
.
current_user
.
authorized_projects
.
search_by_title
(
term
)
sorted_by_stars
.
non_archived
.
limit
(
limit
).
map
do
|
p
|
.
sorted_by_stars
.
non_archived
.
limit
(
limit
).
map
do
|
p
|
{
{
category:
"Projects"
,
category:
"Projects"
,
id:
p
.
id
,
id:
p
.
id
,
...
...
app/models/namespace.rb
View file @
1fbb7f97
...
@@ -47,6 +47,8 @@ class Namespace < ActiveRecord::Base
...
@@ -47,6 +47,8 @@ class Namespace < ActiveRecord::Base
before_destroy
(
prepend:
true
)
{
prepare_for_destroy
}
before_destroy
(
prepend:
true
)
{
prepare_for_destroy
}
after_destroy
:rm_dir
after_destroy
:rm_dir
default_scope
{
with_deleted
}
scope
:for_user
,
->
{
where
(
'type IS NULL'
)
}
scope
:for_user
,
->
{
where
(
'type IS NULL'
)
}
scope
:with_statistics
,
->
do
scope
:with_statistics
,
->
do
...
...
app/models/project.rb
View file @
1fbb7f97
...
@@ -222,7 +222,7 @@ class Project < ActiveRecord::Base
...
@@ -222,7 +222,7 @@ class Project < ActiveRecord::Base
has_many
:uploads
,
as: :model
,
dependent: :destroy
has_many
:uploads
,
as: :model
,
dependent: :destroy
# Scopes
# Scopes
scope
:
with_deleted
,
->
{
where
(
pending_delete:
true
)
}
scope
:
pending_delete
,
->
{
where
(
pending_delete:
true
)
}
scope
:without_deleted
,
->
{
where
(
pending_delete:
false
)
}
scope
:without_deleted
,
->
{
where
(
pending_delete:
false
)
}
scope
:sorted_by_activity
,
->
{
reorder
(
last_activity_at: :desc
)
}
scope
:sorted_by_activity
,
->
{
reorder
(
last_activity_at: :desc
)
}
...
@@ -376,7 +376,6 @@ class Project < ActiveRecord::Base
...
@@ -376,7 +376,6 @@ class Project < ActiveRecord::Base
.
or
(
ptable
[
:description
].
matches
(
pattern
))
.
or
(
ptable
[
:description
].
matches
(
pattern
))
)
)
namespaces
=
unscoped
.
select
(
:id
)
namespaces
=
unscoped
.
select
(
:id
)
.
joins
(
:namespace
)
.
joins
(
:namespace
)
.
where
(
ntable
[
:name
].
matches
(
pattern
))
.
where
(
ntable
[
:name
].
matches
(
pattern
))
...
@@ -1456,7 +1455,7 @@ class Project < ActiveRecord::Base
...
@@ -1456,7 +1455,7 @@ class Project < ActiveRecord::Base
def
pending_delete_twin
def
pending_delete_twin
return
false
unless
path
return
false
unless
path
Project
.
with_deleted
.
find_by_full_path
(
path_with_namespace
)
Project
.
pending_delete
.
find_by_full_path
(
path_with_namespace
)
end
end
##
##
...
...
app/services/ci/register_job_service.rb
View file @
1fbb7f97
...
@@ -54,9 +54,9 @@ module Ci
...
@@ -54,9 +54,9 @@ module Ci
def
builds_for_shared_runner
def
builds_for_shared_runner
new_builds
.
new_builds
.
# don't run projects which have not enabled shared runners and builds
# don't run projects which have not enabled shared runners and builds
joins
(
:project
).
where
(
projects:
{
shared_runners_enabled:
true
,
pending_delete:
false
})
.
joins
(
:project
).
where
(
projects:
{
shared_runners_enabled:
true
,
pending_delete:
false
})
joins
(
'LEFT JOIN project_features ON ci_builds.project_id = project_features.project_id'
).
.
joins
(
'LEFT JOIN project_features ON ci_builds.project_id = project_features.project_id'
)
where
(
'project_features.builds_access_level IS NULL or project_features.builds_access_level > 0'
)
.
.
where
(
'project_features.builds_access_level IS NULL or project_features.builds_access_level > 0'
)
.
# Implement fair scheduling
# Implement fair scheduling
# this returns builds that are ordered by number of running builds
# this returns builds that are ordered by number of running builds
...
...
spec/features/dashboard/todos/todos_spec.rb
View file @
1fbb7f97
...
@@ -317,23 +317,6 @@ feature 'Dashboard Todos' do
...
@@ -317,23 +317,6 @@ feature 'Dashboard Todos' do
end
end
end
end
context
'User has a Todo in a project pending deletion'
do
before
do
deleted_project
=
create
(
:project
,
:public
,
pending_delete:
true
)
create
(
:todo
,
:mentioned
,
user:
user
,
project:
deleted_project
,
target:
issue
,
author:
author
)
create
(
:todo
,
:mentioned
,
user:
user
,
project:
deleted_project
,
target:
issue
,
author:
author
,
state: :done
)
sign_in
(
user
)
visit
dashboard_todos_path
end
it
'shows "All done" message'
do
within
(
'.todos-count'
)
{
expect
(
page
).
to
have_content
'0'
}
expect
(
page
).
to
have_content
'To do 0'
expect
(
page
).
to
have_content
'Done 0'
expect
(
page
).
to
have_selector
(
'.todos-all-done'
,
count:
1
)
end
end
context
'User has a Build Failed todo'
do
context
'User has a Build Failed todo'
do
let!
(
:todo
)
{
create
(
:todo
,
:build_failed
,
user:
user
,
project:
project
,
author:
author
)
}
let!
(
:todo
)
{
create
(
:todo
,
:build_failed
,
user:
user
,
project:
project
,
author:
author
)
}
...
...
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