diff options
-rw-r--r-- | app/services/quick_actions/interpret_service.rb | 3 | ||||
-rw-r--r-- | changelogs/unreleased/toon-copy-meta-data-fix.yml | 5 | ||||
-rw-r--r-- | spec/services/quick_actions/interpret_service_spec.rb | 9 |
3 files changed, 15 insertions, 2 deletions
diff --git a/app/services/quick_actions/interpret_service.rb b/app/services/quick_actions/interpret_service.rb index ceb01c8dc73..8933bef29ee 100644 --- a/app/services/quick_actions/interpret_service.rb +++ b/app/services/quick_actions/interpret_service.rb @@ -286,8 +286,7 @@ module QuickActions end params '#issue | !merge_request' condition do - issuable.persisted? && - current_user.can?(:"update_#{issuable.to_ability_name}", issuable) + current_user.can?(:"update_#{issuable.to_ability_name}", issuable) end parse_params do |issuable_param| extract_references(issuable_param, :issue).first || diff --git a/changelogs/unreleased/toon-copy-meta-data-fix.yml b/changelogs/unreleased/toon-copy-meta-data-fix.yml new file mode 100644 index 00000000000..f2f8a1a82a4 --- /dev/null +++ b/changelogs/unreleased/toon-copy-meta-data-fix.yml @@ -0,0 +1,5 @@ +--- +title: Allow /copy_metadata for new issues and MRs +merge_request: 21953 +author: +type: changed diff --git a/spec/services/quick_actions/interpret_service_spec.rb b/spec/services/quick_actions/interpret_service_spec.rb index 06cad9c00d2..ac0ca1f33a5 100644 --- a/spec/services/quick_actions/interpret_service_spec.rb +++ b/spec/services/quick_actions/interpret_service_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe QuickActions::InterpretService do @@ -863,6 +865,13 @@ describe QuickActions::InterpretService do let(:source_issuable) { create(:labeled_issue, project: project, labels: [inreview_label, todo_label]) } let(:content) { "/copy_metadata #{source_issuable.to_reference}" } + let(:issuable) { build(:issue, project: project) } + end + + it_behaves_like 'copy_metadata command' do + let(:source_issuable) { create(:labeled_issue, project: project, labels: [inreview_label, todo_label]) } + + let(:content) { "/copy_metadata #{source_issuable.to_reference}" } let(:issuable) { issue } end |