diff options
author | Sean McGivern <sean@gitlab.com> | 2018-04-20 08:28:17 +0100 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2018-04-24 13:12:59 +0100 |
commit | db3774376aafbdea8db6840c88bd6d875cb9bac3 (patch) | |
tree | 7f70cce162e8027308ce12730562113ed51de624 /app/services | |
parent | 78aebc49491ee18f76fa3c34a3a4e40e5d3b9421 (diff) | |
download | gitlab-ce-db3774376aafbdea8db6840c88bd6d875cb9bac3.tar.gz |
Make /copy_metadata only handle the first issuable passed
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/quick_actions/interpret_service.rb | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/app/services/quick_actions/interpret_service.rb b/app/services/quick_actions/interpret_service.rb index c1bcff34b6f..bc4febf61f0 100644 --- a/app/services/quick_actions/interpret_service.rb +++ b/app/services/quick_actions/interpret_service.rb @@ -269,21 +269,21 @@ module QuickActions end desc 'Copy labels and milestone from other issue or merge request' - explanation do |issuable_id| - "Copy labels and milestone from issue or merge_request #{issuable_id}." + explanation do |source_issuable| + "Copy labels and milestone from #{source_issuable.to_reference}." end params '#issue | !merge_request' condition do issuable.persisted? && current_user.can?(:"update_#{issuable.to_ability_name}", issuable) end - command :copy_metadata do |issuable_id| - source_issuable = extract_references(issuable_id, :issue).first - source_issuable ||= extract_references(issuable_id, :merge_request).first - + parse_params do |issuable_param| + extract_references(issuable_param, :issue).first || + extract_references(issuable_param, :merge_request).first + end + command :copy_metadata do |source_issuable| if source_issuable.present? && source_issuable.project.id == issuable.project.id @updates[:add_label_ids] = source_issuable.labels.map(&:id) - @updates[:milestone_id] = source_issuable.milestone.id if source_issuable.milestone end end |