Commit e6d6c46b authored by Jonathan Schafer's avatar Jonathan Schafer

Add localization, move code to helper, add test

parent 6aef7178
...@@ -38,6 +38,10 @@ module EE ...@@ -38,6 +38,10 @@ module EE
project_security_vulnerability_path(entity.project, entity, *args) project_security_vulnerability_path(entity.project, entity, *args)
end end
def vulnerability_url(vulnerability)
::Gitlab::UrlBuilder.build(vulnerability)
end
def project_vulnerability_path(project, vulnerability, *args) def project_vulnerability_path(project, vulnerability, *args)
project_security_vulnerability_path(project, vulnerability, *args) project_security_vulnerability_path(project, vulnerability, *args)
end end
......
<% if vulnerability.is_a? Vulnerability %> <% if vulnerability.is_a? Vulnerability %>
Issue created from vulnerability <%= link_to vulnerability.id, Gitlab::UrlBuilder.build(vulnerability) %> <%= _("Issue created from vulnerability") %> <%= link_to vulnerability.id, vulnerability_url(vulnerability) %>
<% end %> <% end %>
### <%= _("Description") %>: ### <%= _("Description") %>:
......
...@@ -142,4 +142,14 @@ RSpec.describe EE::GitlabRoutingHelper do ...@@ -142,4 +142,14 @@ RSpec.describe EE::GitlabRoutingHelper do
end end
end end
end end
describe '#vulnerability_url' do
let_it_be(:vulnerability) { create(:vulnerability) }
subject { vulnerability_url(vulnerability) }
it 'returns the full url of the vulnerability' do
expect(subject).to eq "http://localhost/#{vulnerability.project.namespace.path}/#{vulnerability.project.name}/-/security/vulnerabilities/#{vulnerability.id}"
end
end
end end
...@@ -8,8 +8,6 @@ msgid "" ...@@ -8,8 +8,6 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: gitlab 1.0.0\n" "Project-Id-Version: gitlab 1.0.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-09-22 19:32+0200\n"
"PO-Revision-Date: 2020-09-22 19:32+0200\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n" "Language: \n"
...@@ -14045,6 +14043,9 @@ msgstr "" ...@@ -14045,6 +14043,9 @@ msgstr ""
msgid "Issue cannot be found." msgid "Issue cannot be found."
msgstr "" msgstr ""
msgid "Issue created from vulnerability"
msgstr ""
msgid "Issue events" msgid "Issue events"
msgstr "" msgstr ""
......
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