summaryrefslogtreecommitdiff
path: root/app/services
diff options
context:
space:
mode:
authorFelipe Artur <felipefac@gmail.com>2018-03-28 16:12:56 -0300
committerFelipe Artur <felipefac@gmail.com>2018-04-03 15:51:10 -0300
commit7481fc5aa8e7d6cee3e03480a6b7dd7a7d19307e (patch)
tree5246f7ab9ea3563a2b5b6508d98ac0683c2aecfd /app/services
parent160d29b869673a8f2a3e57cf509e30b93e82a014 (diff)
downloadgitlab-ce-7481fc5aa8e7d6cee3e03480a6b7dd7a7d19307e.tar.gz
Fix 404 in group boards when moving issue between listsissue_44551
Diffstat (limited to 'app/services')
-rw-r--r--app/services/boards/issues/move_service.rb5
-rw-r--r--app/services/issues/update_service.rb17
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