Commit 345dc118 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch '9801-epic-copy-link' into 'master'

Add epic support to UrlBuilder

Closes #9801

See merge request gitlab-org/gitlab!17224
parents 3c2bc9a8 496425bc
---
title: Added 'copy link' in epic comment dropdown.
merge_request: 17224
author:
type: added
......@@ -7,9 +7,22 @@ module EE
override :url
def url
return project_design_url(object.project, object) if object.is_a?(DesignManagement::Design)
case object
when DesignManagement::Design
project_design_url(object.project, object)
when Epic
group_epic_url(object.group, object)
else
super
end
end
override :note_url
def note_url
return super unless object.for_epic?
super
epic = object.noteable
group_epic_url(epic.group, epic, anchor: dom_id(object))
end
end
end
......
......@@ -13,5 +13,26 @@ describe Gitlab::UrlBuilder do
expect(url).to eq "#{Settings.gitlab['url']}/#{design.project.full_path}/-/designs/#{design.id}"
end
end
context 'when passing an epic' do
it 'returns a proper URL' do
epic = build_stubbed(:epic, iid: 42)
url = described_class.build(epic)
expect(url).to eq "#{Settings.gitlab['url']}/groups/#{epic.group.full_path}/-/epics/#{epic.iid}"
end
end
context 'when passing an epic note' do
it 'returns a proper URL' do
epic = create(:epic)
note = build_stubbed(:note_on_epic, noteable: epic)
url = described_class.build(note)
expect(url).to eq "#{Settings.gitlab['url']}/groups/#{epic.group.full_path}/-/epics/#{epic.iid}#note_#{note.id}"
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