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
4702f5f7
Commit
4702f5f7
authored
Aug 23, 2017
by
Felipe Artur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix changing issue position inside list
parent
7c545dee
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
16 additions
and
16 deletions
+16
-16
app/controllers/boards/issues_controller.rb
app/controllers/boards/issues_controller.rb
+1
-1
app/services/boards/issues/move_service.rb
app/services/boards/issues/move_service.rb
+4
-4
app/services/issues/update_service.rb
app/services/issues/update_service.rb
+8
-8
spec/controllers/boards/issues_controller_spec.rb
spec/controllers/boards/issues_controller_spec.rb
+1
-1
spec/ee/spec/controllers/boards/issues_controller_spec.rb
spec/ee/spec/controllers/boards/issues_controller_spec.rb
+1
-1
spec/services/boards/issues/move_service_spec.rb
spec/services/boards/issues/move_service_spec.rb
+1
-1
No files found.
app/controllers/boards/issues_controller.rb
View file @
4702f5f7
...
@@ -65,7 +65,7 @@ module Boards
...
@@ -65,7 +65,7 @@ module Boards
end
end
def
move_params
def
move_params
params
.
permit
(
:board_id
,
:id
,
:from_list_id
,
:to_list_id
,
:move_before_i
id
,
:move_after_i
id
)
params
.
permit
(
:board_id
,
:id
,
:from_list_id
,
:to_list_id
,
:move_before_i
d
,
:move_after_
id
)
end
end
def
issue_params
def
issue_params
...
...
app/services/boards/issues/move_service.rb
View file @
4702f5f7
...
@@ -44,7 +44,7 @@ module Boards
...
@@ -44,7 +44,7 @@ module Boards
)
)
end
end
attrs
[
:move_between_i
ids
]
=
move_between_iids
if
move_between_i
ids
attrs
[
:move_between_i
ds
]
=
move_between_ids
if
move_between_
ids
attrs
attrs
end
end
...
@@ -69,10 +69,10 @@ module Boards
...
@@ -69,10 +69,10 @@ module Boards
Array
(
label_ids
).
compact
Array
(
label_ids
).
compact
end
end
def
move_between_i
i
ds
def
move_between_ids
return
unless
params
[
:move_after_i
id
]
||
params
[
:move_before_i
id
]
return
unless
params
[
:move_after_i
d
]
||
params
[
:move_before_
id
]
[
params
[
:move_after_i
id
],
params
[
:move_before_i
id
]]
[
params
[
:move_after_i
d
],
params
[
:move_before_
id
]]
end
end
end
end
end
end
...
...
app/services/issues/update_service.rb
View file @
4702f5f7
...
@@ -3,7 +3,7 @@ module Issues
...
@@ -3,7 +3,7 @@ module Issues
include
SpamCheckService
include
SpamCheckService
def
execute
(
issue
)
def
execute
(
issue
)
handle_move_between_i
i
ds
(
issue
)
handle_move_between_ids
(
issue
)
filter_spam_check_params
filter_spam_check_params
change_issue_duplicate
(
issue
)
change_issue_duplicate
(
issue
)
update
(
issue
)
update
(
issue
)
...
@@ -54,13 +54,13 @@ module Issues
...
@@ -54,13 +54,13 @@ module Issues
end
end
end
end
def
handle_move_between_i
i
ds
(
issue
)
def
handle_move_between_ids
(
issue
)
return
unless
params
[
:move_between_i
i
ds
]
return
unless
params
[
:move_between_ids
]
after_i
id
,
before_iid
=
params
.
delete
(
:move_between_i
ids
)
after_i
d
,
before_id
=
params
.
delete
(
:move_between_
ids
)
issue_before
=
get_issue_if_allowed
(
issue
.
project
,
before_iid
)
if
before_i
id
issue_before
=
get_issue_if_allowed
(
before_id
)
if
before_
id
issue_after
=
get_issue_if_allowed
(
issue
.
project
,
after_iid
)
if
after_i
id
issue_after
=
get_issue_if_allowed
(
after_id
)
if
after_
id
issue
.
move_between
(
issue_before
,
issue_after
)
issue
.
move_between
(
issue_before
,
issue_after
)
end
end
...
@@ -76,8 +76,8 @@ module Issues
...
@@ -76,8 +76,8 @@ module Issues
private
private
def
get_issue_if_allowed
(
project
,
i
id
)
def
get_issue_if_allowed
(
id
)
issue
=
project
.
issues
.
find_by
(
iid:
i
id
)
issue
=
Issue
.
find
(
id
)
issue
if
can?
(
current_user
,
:update_issue
,
issue
)
issue
if
can?
(
current_user
,
:update_issue
,
issue
)
end
end
...
...
spec/controllers/boards/issues_controller_spec.rb
View file @
4702f5f7
...
@@ -164,7 +164,7 @@ describe Boards::IssuesController do
...
@@ -164,7 +164,7 @@ describe Boards::IssuesController do
post
:create
,
board_id:
board
.
to_param
,
post
:create
,
board_id:
board
.
to_param
,
list_id:
list
.
to_param
,
list_id:
list
.
to_param
,
issue:
{
title:
title
,
project_id:
project
.
id
},
issue:
{
title:
title
,
project_id:
project
.
id
},
format: :json
format: :json
end
end
end
end
...
...
spec/ee/spec/controllers/boards/issues_controller_spec.rb
View file @
4702f5f7
...
@@ -163,7 +163,7 @@ describe Boards::IssuesController do
...
@@ -163,7 +163,7 @@ describe Boards::IssuesController do
post
:create
,
board_id:
board
.
to_param
,
post
:create
,
board_id:
board
.
to_param
,
list_id:
list
.
to_param
,
list_id:
list
.
to_param
,
issue:
{
title:
title
,
project_id:
project_1
.
id
},
issue:
{
title:
title
,
project_id:
project_1
.
id
},
format: :json
format: :json
end
end
end
end
...
...
spec/services/boards/issues/move_service_spec.rb
View file @
4702f5f7
...
@@ -98,7 +98,7 @@ describe Boards::Issues::MoveService do
...
@@ -98,7 +98,7 @@ describe Boards::Issues::MoveService do
issue
.
move_to_end
&&
issue
.
save!
issue
.
move_to_end
&&
issue
.
save!
end
end
params
.
merge!
(
move_after_i
id:
issue1
.
iid
,
move_before_iid:
issue2
.
i
id
)
params
.
merge!
(
move_after_i
d:
issue1
.
id
,
move_before_id:
issue2
.
id
)
described_class
.
new
(
project
,
user
,
params
).
execute
(
issue
)
described_class
.
new
(
project
,
user
,
params
).
execute
(
issue
)
...
...
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