diff options
author | Mateusz Bajorski <ematib@gmail.com> | 2018-01-15 09:46:19 +0300 |
---|---|---|
committer | Mateusz Bajorski <ematib@gmail.com> | 2018-03-03 14:12:38 +0300 |
commit | 4f10cad9ffdc508dbcecd477e93921367a69477d (patch) | |
tree | aae65f666695513cd1f462829955db66da4e199c /app/services/quick_actions/interpret_service.rb | |
parent | 405c4caeb00680d2ca809b56d1d2ea98433611dd (diff) |
Add Inherit quick action
Closes #38450
Diffstat (limited to 'app/services/quick_actions/interpret_service.rb')
-rw-r--r-- | app/services/quick_actions/interpret_service.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/app/services/quick_actions/interpret_service.rb b/app/services/quick_actions/interpret_service.rb index 1e9bd84e749..4abb936e14a 100644 --- a/app/services/quick_actions/interpret_service.rb +++ b/app/services/quick_actions/interpret_service.rb @@ -268,6 +268,24 @@ 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}\"." + end + params '#issue' + 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 + @updates[:add_label_ids] = issue.labels.map(&:id) + + @updates[:milestone_id] = issue.milestone.id if issue.milestone + end + end + desc 'Add a todo' explanation 'Adds a todo.' condition do |