Commit 2cff28a5 authored by Nick Thomas's avatar Nick Thomas

Merge branch 'issue_219492' into 'master'

Create confidential issues on confidential epics

See merge request gitlab-org/gitlab!33646
parents 195329e2 9b6849f1
......@@ -15,17 +15,23 @@ module EE
def handle_issue_epic_link(issue)
return unless params.key?(:epic)
epic_param = params.delete(:epic)
epic = params.delete(:epic)
if epic_param
EpicIssues::CreateService.new(epic_param, current_user, { target_issuable: issue }).execute
if epic
issue.confidential = epic.confidential?
EpicIssues::CreateService.new(epic, current_user, { target_issuable: issue }).execute
else
link = EpicIssue.find_by_issue_id(issue.id)
destroy_epic_link(issue)
end
end
return unless link
def destroy_epic_link(issue)
link = EpicIssue.find_by_issue_id(issue.id)
EpicIssues::DestroyService.new(link, current_user).execute
end
return unless link
EpicIssues::DestroyService.new(link, current_user).execute
end
end
end
......
......@@ -61,6 +61,7 @@ RSpec.describe Issues::CreateService do
expect(issue).to be_persisted
expect(issue.epic).to eq(epic)
expect(issue.confidential).to eq(false)
end
end
......@@ -82,6 +83,18 @@ RSpec.describe Issues::CreateService do
expect(epic.due_date).to eq(milestone.due_date)
end
end
context 'when adding an issue to confidential epic' do
let(:confidential_epic) { create(:epic, group: group, confidential: true) }
it 'creates a confidential issue' do
params = { title: 'confidential issue', epic_id: confidential_epic.id }
issue = described_class.new(project, user, params).execute
expect(issue.confidential).to eq(true)
end
end
end
end
end
......
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