summaryrefslogtreecommitdiff
path: root/app/services
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-03-17 11:11:22 +0100
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-03-17 11:48:51 +0100
commitb9036ba61012e6723426f98171a2c111abb0bae5 (patch)
treea249a06e9e80a7db1f2ae53dc8ae99402492eef7 /app/services
parentdda7f9635fe96eba52110979914ff966188f6e8b (diff)
downloadgitlab-ce-b9036ba61012e6723426f98171a2c111abb0bae5.tar.gz
Prevent issue move if issue has been already moved
Diffstat (limited to 'app/services')
-rw-r--r--app/services/issues/move_service.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/app/services/issues/move_service.rb b/app/services/issues/move_service.rb
index ce31830f2d0..47b58d973f9 100644
--- a/app/services/issues/move_service.rb
+++ b/app/services/issues/move_service.rb
@@ -33,6 +33,7 @@ module Issues
#
add_moved_to_note
close_old_issue
+ mark_as_moved
end
notify_participants
@@ -47,8 +48,8 @@ module Issues
private
def can_move?
- can?(@current_user, :admin_issue, @project_old) &&
- can?(@current_user, :admin_issue, @project_new)
+ @issue_old.can_move?(@current_user) &&
+ @issue_old.can_move?(@current_user, @project_new)
end
def create_new_issue
@@ -96,5 +97,9 @@ module Issues
def notify_participants
notification_service.issue_moved(@issue_old, @issue_new, @current_user)
end
+
+ def mark_as_moved
+ @issue_old.update(moved_to: @issue_new)
+ end
end
end