diff options
author | Mateusz Bajorski <ematib@gmail.com> | 2018-01-31 20:41:06 +0300 |
---|---|---|
committer | Mateusz Bajorski <ematib@gmail.com> | 2018-03-03 14:12:38 +0300 |
commit | 26087ae91c0397054786bed7bcc078b03dd8752b (patch) | |
tree | e86b8604bac56bce109a19cdde42df95c56a9bbe /app/services/quick_actions | |
parent | a0adf87707e44fda83aca859b41ce18372a1c72b (diff) |
Fixed typos and improved reference checking
Diffstat (limited to 'app/services/quick_actions')
-rw-r--r-- | app/services/quick_actions/interpret_service.rb | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/app/services/quick_actions/interpret_service.rb b/app/services/quick_actions/interpret_service.rb index 28fa887bf2d..87937fef8f4 100644 --- a/app/services/quick_actions/interpret_service.rb +++ b/app/services/quick_actions/interpret_service.rb @@ -269,22 +269,22 @@ module QuickActions end 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}\"." + explanation do |issuable_id| + "Copy labels and milestone from issue or merge_request \"#{issuable_id}\"." end - params '< #issue | !merge_request >' + params '#issue | !merge_request' condition do issuable.persisted? && current_user.can?(:"update_#{issuable.to_ability_name}", issuable) end - command :copy_metadata do |issueable_id| - reference_type = issueable_id.include?("#") ? :issue : :merge_request - issue = extract_references(issueable_id, reference_type).first + command :copy_metadata do |issuable_id| + source_issuable = extract_references(issuable_id, :issue).first + source_issuable = extract_references(issuable_id, :merge_request).first if !source_issuable.present? - if issue.present? && issue.project.id == issuable.project.id - @updates[:add_label_ids] = issue.labels.map(&:id) + if source_issuable.present? && source_issuable.project.id == issuable.project.id + @updates[:add_label_ids] = source_issuable.labels.map(&:id) - @updates[:milestone_id] = issue.milestone.id if issue.milestone + @updates[:milestone_id] = source_issuable.milestone.id if source_issuable.milestone end end |