Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-08-03 04:53:44 +0300
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-08-17 18:58:58 +0300
commit75f0bc4af87b418b6b27f69c03bf9fa4756cedfc (patch)
treed8ceb711fb1d5f931d03801aeedbaf3aa71b3f45 /app/services/boards
parentaff7a2ef55b317b3e5c8d83f4e9ae9fc64f4fa8f (diff)
Add endpoint to allow users to move issues between lists
Diffstat (limited to 'app/services/boards')
-rw-r--r--app/services/boards/issues/move_service.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/app/services/boards/issues/move_service.rb b/app/services/boards/issues/move_service.rb
index 7d08ef5b6c7..657268e67b3 100644
--- a/app/services/boards/issues/move_service.rb
+++ b/app/services/boards/issues/move_service.rb
@@ -3,6 +3,7 @@ module Boards
class MoveService < Boards::BaseService
def execute
return false unless issue.present?
+ return false unless valid_move?
return false unless user.can?(:update_issue, issue)
update_service.execute(issue)
@@ -14,16 +15,20 @@ module Boards
private
+ def valid_move?
+ moving_from.present? && moving_to.present?
+ end
+
def issue
@issue ||= project.issues.visible_to_user(user).find_by!(iid: params[:id])
end
def moving_from
- @moving_from ||= board.lists.find(params[:from])
+ @moving_from ||= board.lists.find_by(id: params[:from])
end
def moving_to
- @moving_to ||= board.lists.find(params[:to])
+ @moving_to ||= board.lists.find_by(id: params[:to])
end
def close_service