diff options
author | Mateusz Bajorski <ematib@gmail.com> | 2018-01-21 18:16:56 +0100 |
---|---|---|
committer | Mateusz Bajorski <ematib@gmail.com> | 2018-03-03 12:12:38 +0100 |
commit | a0adf87707e44fda83aca859b41ce18372a1c72b (patch) | |
tree | e22f584c448c5a1c6b4664f1f7efb175e24a7493 /app | |
parent | 4f10cad9ffdc508dbcecd477e93921367a69477d (diff) | |
download | gitlab-ce-a0adf87707e44fda83aca859b41ce18372a1c72b.tar.gz |
Changed command name to copy_metadata and added MR support
Diffstat (limited to 'app')
-rw-r--r-- | app/services/quick_actions/interpret_service.rb | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/app/services/quick_actions/interpret_service.rb b/app/services/quick_actions/interpret_service.rb index 4abb936e14a..28fa887bf2d 100644 --- a/app/services/quick_actions/interpret_service.rb +++ b/app/services/quick_actions/interpret_service.rb @@ -268,18 +268,20 @@ module QuickActions end end - desc 'Inherit (copy) labels and milestone from other issue' - explanation do |issue_id| - "Inherit (copy) labels and milestone from issue \"#{issue_id}\"." + desc 'Copy labels and milestone from other issue or merge request' + explanation do |issueable_id| + "Copy labels and milestone from issue or merge_request \"#{issueable_id}\"." end - params '#issue' + params '< #issue | !merge_request >' condition do issuable.persisted? && current_user.can?(:"update_#{issuable.to_ability_name}", issuable) end - command :inherit do |issue_id| - issue = extract_references(issue_id, :issue).first - if issue.present? && issue.project_id == issuable.project_id + command :copy_metadata do |issueable_id| + reference_type = issueable_id.include?("#") ? :issue : :merge_request + issue = extract_references(issueable_id, reference_type).first + + if issue.present? && issue.project.id == issuable.project.id @updates[:add_label_ids] = issue.labels.map(&:id) @updates[:milestone_id] = issue.milestone.id if issue.milestone |