Commit 30d1d47d authored by Alejandro Rodríguez's avatar Alejandro Rodríguez
Browse files

Using project `path_with_namespace` in milestone's cross project references link text

parent c0c922827187
...@@ -39,7 +39,7 @@ def object_link_text(object, matches) ...@@ -39,7 +39,7 @@ def object_link_text(object, matches)
if context[:project] == object.project if context[:project] == object.project
super super
else else
"#{escape_once(super)} <i>in #{escape_once(object.project.name_with_namespace)}</i>". "#{escape_once(super)} <i>in #{escape_once(object.project.path_with_namespace)}</i>".
html_safe html_safe
end end
end end
......
...@@ -160,7 +160,7 @@ ...@@ -160,7 +160,7 @@
describe 'cross project milestone references' do describe 'cross project milestone references' do
let(:another_project) { create(:empty_project, :public) } let(:another_project) { create(:empty_project, :public) }
let(:project_name) { another_project.name_with_namespace } let(:project_path) { another_project.path_with_namespace }
let(:milestone) { create(:milestone, project: another_project) } let(:milestone) { create(:milestone, project: another_project) }
let(:reference) { milestone.to_reference(project) } let(:reference) { milestone.to_reference(project) }
...@@ -174,13 +174,13 @@ ...@@ -174,13 +174,13 @@
end end
it 'contains cross project content' do it 'contains cross project content' do
expect(result.css('a').first.text).to eq "#{milestone.name} in #{project_name}" expect(result.css('a').first.text).to eq "#{milestone.name} in #{project_path}"
end end
it 'escapes the name attribute' do it 'escapes the name attribute' do
allow_any_instance_of(Milestone).to receive(:title).and_return(%{"></a>whatever<a title="}) allow_any_instance_of(Milestone).to receive(:title).and_return(%{"></a>whatever<a title="})
doc = reference_filter("See #{reference}") doc = reference_filter("See #{reference}")
expect(doc.css('a').first.text).to eq "#{milestone.name} in #{project_name}" expect(doc.css('a').first.text).to eq "#{milestone.name} in #{project_path}"
end 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