Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
7481fc5a
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,发现更多精彩内容 >>
提交
7481fc5a
编写于
3月 28, 2018
作者:
F
Felipe Artur
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix 404 in group boards when moving issue between lists
上级
160d29b8
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
69 addition
and
8 deletion
+69
-8
app/assets/javascripts/boards/services/board_service.js
app/assets/javascripts/boards/services/board_service.js
+1
-1
app/services/boards/issues/move_service.rb
app/services/boards/issues/move_service.rb
+4
-1
app/services/issues/update_service.rb
app/services/issues/update_service.rb
+13
-4
changelogs/unreleased/issue_44551.yml
changelogs/unreleased/issue_44551.yml
+5
-0
spec/services/boards/issues/move_service_spec.rb
spec/services/boards/issues/move_service_spec.rb
+1
-1
spec/services/issues/update_service_spec.rb
spec/services/issues/update_service_spec.rb
+31
-0
spec/support/shared_examples/services/boards/issues_move_service.rb
...rt/shared_examples/services/boards/issues_move_service.rb
+14
-1
未找到文件。
app/assets/javascripts/boards/services/board_service.js
浏览文件 @
7481fc5a
...
...
@@ -19,7 +19,7 @@ export default class BoardService {
}
static
generateIssuePath
(
boardId
,
id
)
{
return
`
${
gon
.
relative_url_root
}
/-/boards/
${
boardId
?
`
/
${
boardId
}
`
:
''
}
/issues
${
id
?
`/
${
id
}
`
:
''
}
`
;
return
`
${
gon
.
relative_url_root
}
/-/boards/
${
boardId
?
`
${
boardId
}
`
:
''
}
/issues
${
id
?
`/
${
id
}
`
:
''
}
`
;
}
all
()
{
...
...
app/services/boards/issues/move_service.rb
浏览文件 @
7481fc5a
...
...
@@ -42,7 +42,10 @@ module Boards
)
end
attrs
[
:move_between_ids
]
=
move_between_ids
if
move_between_ids
if
move_between_ids
attrs
[
:move_between_ids
]
=
move_between_ids
attrs
[
:board_group_id
]
=
board
.
group
&
.
id
end
attrs
end
...
...
app/services/issues/update_service.rb
浏览文件 @
7481fc5a
...
...
@@ -55,9 +55,10 @@ module Issues
return
unless
params
[
:move_between_ids
]
after_id
,
before_id
=
params
.
delete
(
:move_between_ids
)
board_group_id
=
params
.
delete
(
:board_group_id
)
issue_before
=
get_issue_if_allowed
(
issue
.
project
,
before_id
)
if
before_id
issue_after
=
get_issue_if_allowed
(
issue
.
project
,
after_id
)
if
after_id
issue_before
=
get_issue_if_allowed
(
before_id
,
board_group_id
)
issue_after
=
get_issue_if_allowed
(
after_id
,
board_group_id
)
issue
.
move_between
(
issue_before
,
issue_after
)
end
...
...
@@ -84,8 +85,16 @@ module Issues
private
def
get_issue_if_allowed
(
project
,
id
)
issue
=
project
.
issues
.
find
(
id
)
def
get_issue_if_allowed
(
id
,
board_group_id
=
nil
)
return
unless
id
issue
=
if
board_group_id
IssuesFinder
.
new
(
current_user
,
group_id:
board_group_id
).
find_by
(
id:
id
)
else
project
.
issues
.
find
(
id
)
end
issue
if
can?
(
current_user
,
:update_issue
,
issue
)
end
...
...
changelogs/unreleased/issue_44551.yml
0 → 100644
浏览文件 @
7481fc5a
---
title
:
Fix 404 in group boards when moving issue between lists
merge_request
:
author
:
type
:
fixed
spec/services/boards/issues/move_service_spec.rb
浏览文件 @
7481fc5a
...
...
@@ -48,7 +48,7 @@ describe Boards::Issues::MoveService do
parent
.
add_developer
(
user
)
end
it_behaves_like
'issues move service'
it_behaves_like
'issues move service'
,
true
end
end
end
spec/services/issues/update_service_spec.rb
浏览文件 @
7481fc5a
...
...
@@ -97,6 +97,37 @@ describe Issues::UpdateService, :mailer do
expect
(
issue
.
relative_position
).
to
be_between
(
issue1
.
relative_position
,
issue2
.
relative_position
)
end
context
'when moving issue between issues from different projects'
do
let
(
:group
)
{
create
(
:group
)
}
let
(
:project_1
)
{
create
(
:project
,
namespace:
group
)
}
let
(
:project_2
)
{
create
(
:project
,
namespace:
group
)
}
let
(
:project_3
)
{
create
(
:project
,
namespace:
group
)
}
let
(
:issue_1
)
{
create
(
:issue
,
project:
project_1
)
}
let
(
:issue_2
)
{
create
(
:issue
,
project:
project_2
)
}
let
(
:issue_3
)
{
create
(
:issue
,
project:
project_3
)
}
before
do
group
.
add_developer
(
user
)
end
it
'sorts issues as specified by parameters'
do
# Moving all issues to end here like the last example won't work since
# all projects only have the same issue count
# so their relative_position will be the same.
issue_1
.
move_to_end
issue_2
.
move_after
(
issue_1
)
issue_3
.
move_after
(
issue_2
)
[
issue_1
,
issue_2
,
issue_3
].
map
(
&
:save
)
opts
[
:move_between_ids
]
=
[
issue_1
.
id
,
issue_2
.
id
]
opts
[
:board_group_id
]
=
group
.
id
described_class
.
new
(
issue_3
.
project
,
user
,
opts
).
execute
(
issue_3
)
expect
(
issue_2
.
relative_position
).
to
be_between
(
issue_1
.
relative_position
,
issue_2
.
relative_position
)
end
end
context
'when current user cannot admin issues in the project'
do
let
(
:guest
)
{
create
(
:user
)
}
before
do
...
...
spec/support/shared_examples/services/boards/issues_move_service.rb
浏览文件 @
7481fc5a
shared_examples
'issues move service'
do
shared_examples
'issues move service'
do
|
group
|
context
'when moving an issue between lists'
do
let
(
:issue
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
bug
,
development
])
}
let
(
:params
)
{
{
board_id:
board1
.
id
,
from_list_id:
list1
.
id
,
to_list_id:
list2
.
id
}
}
...
...
@@ -83,5 +83,18 @@ shared_examples 'issues move service' do
expect
(
issue
.
relative_position
).
to
be_between
(
issue1
.
relative_position
,
issue2
.
relative_position
)
end
if
group
context
'when on a group board'
do
it
'sends the board_group_id parameter'
do
params
.
merge!
(
move_after_id:
issue1
.
id
,
move_before_id:
issue2
.
id
)
match_params
=
{
move_between_ids:
[
issue1
.
id
,
issue2
.
id
],
board_group_id:
parent
.
id
}
expect
(
Issues
::
UpdateService
).
to
receive
(
:new
).
with
(
issue
.
project
,
user
,
match_params
).
and_return
(
double
(
execute:
build
(
:issue
)))
described_class
.
new
(
parent
,
user
,
params
).
execute
(
issue
)
end
end
end
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录