Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
1fbb7f97
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1fbb7f97
编写于
6月 19, 2017
作者:
T
Tiago Botelho
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Removes redundant pending delete checks
上级
34f57b46
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
10 addition
and
27 deletion
+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
未找到文件。
app/finders/todos_finder.rb
浏览文件 @
1fbb7f97
...
...
@@ -78,7 +78,6 @@ class TodosFinder
end
def
project
return
nil
if
@project
&
.
pending_delete?
return
@project
if
defined?
(
@project
)
if
project?
...
...
@@ -98,7 +97,7 @@ class TodosFinder
def
projects
(
items
)
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
def
type?
...
...
app/helpers/search_helper.rb
浏览文件 @
1fbb7f97
...
...
@@ -97,8 +97,8 @@ module SearchHelper
# Autocomplete results for the current user's projects
def
projects_autocomplete
(
term
,
limit
=
5
)
current_user
.
authorized_projects
.
search_by_title
(
term
)
.
sorted_by_stars
.
non_archived
.
limit
(
limit
).
map
do
|
p
|
current_user
.
authorized_projects
.
search_by_title
(
term
)
.
sorted_by_stars
.
non_archived
.
limit
(
limit
).
map
do
|
p
|
{
category:
"Projects"
,
id:
p
.
id
,
...
...
app/models/namespace.rb
浏览文件 @
1fbb7f97
...
...
@@ -47,6 +47,8 @@ class Namespace < ActiveRecord::Base
before_destroy
(
prepend:
true
)
{
prepare_for_destroy
}
after_destroy
:rm_dir
default_scope
{
with_deleted
}
scope
:for_user
,
->
{
where
(
'type IS NULL'
)
}
scope
:with_statistics
,
->
do
...
...
app/models/project.rb
浏览文件 @
1fbb7f97
...
...
@@ -222,7 +222,7 @@ class Project < ActiveRecord::Base
has_many
:uploads
,
as: :model
,
dependent: :destroy
# Scopes
scope
:
with_deleted
,
->
{
where
(
pending_delete:
true
)
}
scope
:
pending_delete
,
->
{
where
(
pending_delete:
true
)
}
scope
:without_deleted
,
->
{
where
(
pending_delete:
false
)
}
scope
:sorted_by_activity
,
->
{
reorder
(
last_activity_at: :desc
)
}
...
...
@@ -376,7 +376,6 @@ class Project < ActiveRecord::Base
.
or
(
ptable
[
:description
].
matches
(
pattern
))
)
namespaces
=
unscoped
.
select
(
:id
)
.
joins
(
:namespace
)
.
where
(
ntable
[
:name
].
matches
(
pattern
))
...
...
@@ -1456,7 +1455,7 @@ class Project < ActiveRecord::Base
def
pending_delete_twin
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
##
...
...
app/services/ci/register_job_service.rb
浏览文件 @
1fbb7f97
...
...
@@ -54,9 +54,9 @@ module Ci
def
builds_for_shared_runner
new_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
(
'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'
)
.
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'
)
.
where
(
'project_features.builds_access_level IS NULL or project_features.builds_access_level > 0'
)
.
# Implement fair scheduling
# this returns builds that are ordered by number of running builds
...
...
spec/features/dashboard/todos/todos_spec.rb
浏览文件 @
1fbb7f97
...
...
@@ -317,23 +317,6 @@ feature 'Dashboard Todos' do
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
let!
(
:todo
)
{
create
(
:todo
,
:build_failed
,
user:
user
,
project:
project
,
author:
author
)
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录