diff options
author | Felipe Artur <felipefac@gmail.com> | 2018-03-28 22:12:56 +0300 |
---|---|---|
committer | Felipe Artur <felipefac@gmail.com> | 2018-04-03 21:51:10 +0300 |
commit | 7481fc5aa8e7d6cee3e03480a6b7dd7a7d19307e (patch) | |
tree | 5246f7ab9ea3563a2b5b6508d98ac0683c2aecfd /app/services | |
parent | 160d29b869673a8f2a3e57cf509e30b93e82a014 (diff) |
Fix 404 in group boards when moving issue between lists
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/boards/issues/move_service.rb | 5 | ||||
-rw-r--r-- | app/services/issues/update_service.rb | 17 |
2 files changed, 17 insertions, 5 deletions
diff --git a/app/services/boards/issues/move_service.rb b/app/services/boards/issues/move_service.rb index 15fed7d17c1..3ceab209f3f 100644 --- a/app/services/boards/issues/move_service.rb +++ b/app/services/boards/issues/move_service.rb @@ -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 diff --git a/app/services/issues/update_service.rb b/app/services/issues/update_service.rb index d7aa7e2347e..4161932ad2a 100644 --- a/app/services/issues/update_service.rb +++ b/app/services/issues/update_service.rb @@ -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 |