Commit babb05a1 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'toon-copy-meta-data-fix' into 'master'

Allow /copy_metadata for new issues

Closes #50181

See merge request gitlab-org/gitlab-ce!21953
parents 489a5753 5a376063
...@@ -286,8 +286,7 @@ module QuickActions ...@@ -286,8 +286,7 @@ module QuickActions
end end
params '#issue | !merge_request' params '#issue | !merge_request'
condition do condition do
issuable.persisted? && current_user.can?(:"update_#{issuable.to_ability_name}", issuable)
current_user.can?(:"update_#{issuable.to_ability_name}", issuable)
end end
parse_params do |issuable_param| parse_params do |issuable_param|
extract_references(issuable_param, :issue).first || extract_references(issuable_param, :issue).first ||
......
---
title: Allow /copy_metadata for new issues and MRs
merge_request: 21953
author:
type: changed
# frozen_string_literal: true
require 'spec_helper' require 'spec_helper'
describe QuickActions::InterpretService do describe QuickActions::InterpretService do
...@@ -859,6 +861,13 @@ describe QuickActions::InterpretService do ...@@ -859,6 +861,13 @@ describe QuickActions::InterpretService do
let(:issuable) { issue } let(:issuable) { issue }
end 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) { build(:issue, project: project) }
end
it_behaves_like 'copy_metadata command' do it_behaves_like 'copy_metadata command' do
let(:source_issuable) { create(:labeled_issue, project: project, labels: [inreview_label, todo_label]) } let(:source_issuable) { create(:labeled_issue, project: project, labels: [inreview_label, todo_label]) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment