diff options
author | Ryan Scott <ryan@ryan-scott.me> | 2017-03-30 10:39:06 +0900 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2017-07-20 15:33:24 +0100 |
commit | 01c9488f4a559063eba77074ba2d369de87b8018 (patch) | |
tree | ffd18d3ebd174cf47ab9eb71cbacd940d4cf2831 /app/services/quick_actions | |
parent | b6555693a8e445405c5746b7c76c9f603395bba2 (diff) | |
download | gitlab-ce-01c9488f4a559063eba77074ba2d369de87b8018.tar.gz |
Added slash command to close an issue as a duplicate. Closes #26372
Diffstat (limited to 'app/services/quick_actions')
-rw-r--r-- | app/services/quick_actions/interpret_service.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/app/services/quick_actions/interpret_service.rb b/app/services/quick_actions/interpret_service.rb index 6f82159e6c7..3eecf0b5545 100644 --- a/app/services/quick_actions/interpret_service.rb +++ b/app/services/quick_actions/interpret_service.rb @@ -471,6 +471,20 @@ module QuickActions end end + desc 'Mark this issue as a duplicate of another issue' + params '#issue' + condition do + issuable.is_a?(Issue) && + issuable.persisted? && + current_user.can?(:"update_#{issuable.to_ability_name}", issuable) + end + command :duplicate do |duplicate_param| + original_issue = extract_references(duplicate_param, :issue).first + if original_issue.present? && original_issue != issuable + @updates[:original_issue_id] = original_issue.id + end + end + def extract_users(params) return [] if params.nil? |