summaryrefslogtreecommitdiff
path: root/app/services/issues
diff options
context:
space:
mode:
authorManolis Mavrofidis <mavrofidise@gmail.com>2017-08-09 18:37:06 +0300
committermanolis <mavrofidise@gmail.com>2017-08-31 21:30:36 +0100
commit7e71f958ac721f5c36c20a5366c1e46adce4c67d (patch)
tree63b74b20bdb22d42afcd82764fdf97f01d8c655a /app/services/issues
parent420d835e5fb41e1c3291a814f807b555b24646ca (diff)
downloadgitlab-ce-7e71f958ac721f5c36c20a5366c1e46adce4c67d.tar.gz
/move project functionality. Squash commit.
Update to add all issues to be updated. Added functionality, proper tests, documentation and changelog.
Diffstat (limited to 'app/services/issues')
-rw-r--r--app/services/issues/update_service.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/app/services/issues/update_service.rb b/app/services/issues/update_service.rb
index 8d918ccc635..deb4990eb4f 100644
--- a/app/services/issues/update_service.rb
+++ b/app/services/issues/update_service.rb
@@ -6,7 +6,7 @@ module Issues
handle_move_between_iids(issue)
filter_spam_check_params
change_issue_duplicate(issue)
- update(issue)
+ move_issue_to_new_project(issue) || update(issue)
end
def before_update(issue)
@@ -74,6 +74,17 @@ module Issues
end
end
+ def move_issue_to_new_project(issue)
+ target_project = params.delete(:target_project)
+
+ return unless target_project &&
+ issue.can_move?(current_user, target_project) &&
+ target_project != issue.project
+
+ update(issue)
+ Issues::MoveService.new(project, current_user).execute(issue, target_project)
+ end
+
private
def get_issue_if_allowed(project, iid)