Commit 5a376063 authored by Toon Claes's avatar Toon Claes

Allow /copy_metadata for new issues

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/50181
parent 62dde350
...@@ -290,8 +290,7 @@ module QuickActions ...@@ -290,8 +290,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