Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
6c190d27
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,体验更适合开发者的 AI 搜索 >>
提交
6c190d27
编写于
5月 18, 2018
作者:
S
Stan Hu
提交者:
Robert Speicher
5月 18, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move API group deletion to Sidekiq
上级
d6c8a551
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
25 addition
and
9 deletion
+25
-9
changelogs/unreleased/sh-move-delete-groups-api-async.yml
changelogs/unreleased/sh-move-delete-groups-api-async.yml
+5
-0
doc/api/groups.md
doc/api/groups.md
+3
-0
lib/api/groups.rb
lib/api/groups.rb
+3
-1
lib/api/v3/groups.rb
lib/api/v3/groups.rb
+3
-2
spec/requests/api/groups_spec.rb
spec/requests/api/groups_spec.rb
+6
-3
spec/requests/api/v3/groups_spec.rb
spec/requests/api/v3/groups_spec.rb
+5
-3
未找到文件。
changelogs/unreleased/sh-move-delete-groups-api-async.yml
0 → 100644
浏览文件 @
6c190d27
---
title
:
Move API group deletion to Sidekiq
merge_request
:
author
:
type
:
changed
doc/api/groups.md
浏览文件 @
6c190d27
...
@@ -487,6 +487,9 @@ Parameters:
...
@@ -487,6 +487,9 @@ Parameters:
-
`id`
(required) - The ID or path of a user group
-
`id`
(required) - The ID or path of a user group
This will queue a background job to delete all projects in the group. The
response will be a 202 Accepted if the user has authorization.
## Search for group
## Search for group
Get all groups that match your string in their name or path.
Get all groups that match your string in their name or path.
...
...
lib/api/groups.rb
浏览文件 @
6c190d27
...
@@ -167,8 +167,10 @@ module API
...
@@ -167,8 +167,10 @@ module API
Gitlab
::
QueryLimiting
.
whitelist
(
'https://gitlab.com/gitlab-org/gitlab-ce/issues/46285'
)
Gitlab
::
QueryLimiting
.
whitelist
(
'https://gitlab.com/gitlab-org/gitlab-ce/issues/46285'
)
destroy_conditionally!
(
group
)
do
|
group
|
destroy_conditionally!
(
group
)
do
|
group
|
::
Groups
::
DestroyService
.
new
(
group
,
current_user
).
execute
::
Groups
::
DestroyService
.
new
(
group
,
current_user
).
async_
execute
end
end
accepted!
end
end
desc
'Get a list of projects in this group.'
do
desc
'Get a list of projects in this group.'
do
...
...
lib/api/v3/groups.rb
浏览文件 @
6c190d27
...
@@ -131,8 +131,9 @@ module API
...
@@ -131,8 +131,9 @@ module API
delete
":id"
do
delete
":id"
do
group
=
find_group!
(
params
[
:id
])
group
=
find_group!
(
params
[
:id
])
authorize!
:admin_group
,
group
authorize!
:admin_group
,
group
Gitlab
::
QueryLimiting
.
whitelist
(
'https://gitlab.com/gitlab-org/gitlab-ce/issues/46285'
)
::
Groups
::
DestroyService
.
new
(
group
,
current_user
).
async_execute
present
::
Groups
::
DestroyService
.
new
(
group
,
current_user
).
execute
,
with:
Entities
::
GroupDetail
,
current_user:
current_user
accepted!
end
end
desc
'Get a list of projects in this group.'
do
desc
'Get a list of projects in this group.'
do
...
...
spec/requests/api/groups_spec.rb
浏览文件 @
6c190d27
...
@@ -738,13 +738,16 @@ describe API::Groups do
...
@@ -738,13 +738,16 @@ describe API::Groups do
describe
"DELETE /groups/:id"
do
describe
"DELETE /groups/:id"
do
context
"when authenticated as user"
do
context
"when authenticated as user"
do
it
"removes group"
do
it
"removes group"
do
delete
api
(
"/groups/
#{
group1
.
id
}
"
,
user1
)
Sidekiq
::
Testing
.
fake!
do
expect
{
delete
api
(
"/groups/
#{
group1
.
id
}
"
,
user1
)
}.
to
change
(
GroupDestroyWorker
.
jobs
,
:size
).
by
(
1
)
end
expect
(
response
).
to
have_gitlab_http_status
(
20
4
)
expect
(
response
).
to
have_gitlab_http_status
(
20
2
)
end
end
it_behaves_like
'412 response'
do
it_behaves_like
'412 response'
do
let
(
:request
)
{
api
(
"/groups/
#{
group1
.
id
}
"
,
user1
)
}
let
(
:request
)
{
api
(
"/groups/
#{
group1
.
id
}
"
,
user1
)
}
let
(
:success_status
)
{
202
}
end
end
it
"does not remove a group if not an owner"
do
it
"does not remove a group if not an owner"
do
...
@@ -773,7 +776,7 @@ describe API::Groups do
...
@@ -773,7 +776,7 @@ describe API::Groups do
it
"removes any existing group"
do
it
"removes any existing group"
do
delete
api
(
"/groups/
#{
group2
.
id
}
"
,
admin
)
delete
api
(
"/groups/
#{
group2
.
id
}
"
,
admin
)
expect
(
response
).
to
have_gitlab_http_status
(
20
4
)
expect
(
response
).
to
have_gitlab_http_status
(
20
2
)
end
end
it
"does not remove a non existing group"
do
it
"does not remove a non existing group"
do
...
...
spec/requests/api/v3/groups_spec.rb
浏览文件 @
6c190d27
...
@@ -458,9 +458,11 @@ describe API::V3::Groups do
...
@@ -458,9 +458,11 @@ describe API::V3::Groups do
describe
"DELETE /groups/:id"
do
describe
"DELETE /groups/:id"
do
context
"when authenticated as user"
do
context
"when authenticated as user"
do
it
"removes group"
do
it
"removes group"
do
delete
v3_api
(
"/groups/
#{
group1
.
id
}
"
,
user1
)
Sidekiq
::
Testing
.
fake!
do
expect
{
delete
v3_api
(
"/groups/
#{
group1
.
id
}
"
,
user1
)
}.
to
change
(
GroupDestroyWorker
.
jobs
,
:size
).
by
(
1
)
end
expect
(
response
).
to
have_gitlab_http_status
(
20
0
)
expect
(
response
).
to
have_gitlab_http_status
(
20
2
)
end
end
it
"does not remove a group if not an owner"
do
it
"does not remove a group if not an owner"
do
...
@@ -489,7 +491,7 @@ describe API::V3::Groups do
...
@@ -489,7 +491,7 @@ describe API::V3::Groups do
it
"removes any existing group"
do
it
"removes any existing group"
do
delete
v3_api
(
"/groups/
#{
group2
.
id
}
"
,
admin
)
delete
v3_api
(
"/groups/
#{
group2
.
id
}
"
,
admin
)
expect
(
response
).
to
have_gitlab_http_status
(
20
0
)
expect
(
response
).
to
have_gitlab_http_status
(
20
2
)
end
end
it
"does not remove a non existing group"
do
it
"does not remove a non existing group"
do
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录