Commit 32173740 authored by Paul Slaughter's avatar Paul Slaughter

I18n createTempEntry flash message

Also consolidates very similar message in modal.vue so that
there is only one gitlab.pot entry.
parent e40ded8c
...@@ -67,8 +67,8 @@ export default { ...@@ -67,8 +67,8 @@ export default {
if (this.entryModal.type === modalTypes.rename) { if (this.entryModal.type === modalTypes.rename) {
if (this.entries[this.entryName] && !this.entries[this.entryName].deleted) { if (this.entries[this.entryName] && !this.entries[this.entryName].deleted) {
flash( flash(
sprintf(s__('The name %{entryName} is already taken in this directory.'), { sprintf(s__('The name "%{name}" is already taken in this directory.'), {
entryName: this.entryName, name: this.entryName,
}), }),
'alert', 'alert',
document, document,
......
...@@ -72,7 +72,9 @@ export const createTempEntry = ( ...@@ -72,7 +72,9 @@ export const createTempEntry = (
if (state.entries[name] && !state.entries[name].deleted) { if (state.entries[name] && !state.entries[name].deleted) {
flash( flash(
`The name "${name.split('/').pop()}" is already taken in this directory.`, sprintf(__('The name "%{name}" is already taken in this directory.'), {
name: name.split('/').pop(),
}),
'alert', 'alert',
document, document,
null, null,
......
...@@ -18224,7 +18224,7 @@ msgstr "" ...@@ -18224,7 +18224,7 @@ msgstr ""
msgid "The merge request can now be merged." msgid "The merge request can now be merged."
msgstr "" msgstr ""
msgid "The name %{entryName} is already taken in this directory." msgid "The name \"%{name}\" is already taken in this directory."
msgstr "" msgstr ""
msgid "The number of changes to be fetched from GitLab when cloning a repository. This can speed up Pipelines execution. Keep empty or set to 0 to disable shallow clone by default and make GitLab CI fetch all branches and tags each time." msgid "The number of changes to be fetched from GitLab when cloning a repository. This can speed up Pipelines execution. Keep empty or set to 0 to disable shallow clone by default and make GitLab CI fetch all branches and tags each time."
......
...@@ -132,9 +132,19 @@ describe('new file modal component', () => { ...@@ -132,9 +132,19 @@ describe('new file modal component', () => {
vm = createComponentWithStore(Component, store).$mount(); vm = createComponentWithStore(Component, store).$mount();
const flashSpy = spyOnDependency(modal, 'flash'); const flashSpy = spyOnDependency(modal, 'flash');
expect(flashSpy).not.toHaveBeenCalled();
vm.submitForm(); vm.submitForm();
expect(flashSpy).toHaveBeenCalled(); expect(flashSpy).toHaveBeenCalledWith(
'The name "test-path/test" is already taken in this directory.',
'alert',
jasmine.anything(),
null,
false,
true,
);
}); });
}); });
}); });
...@@ -356,7 +356,9 @@ describe('Multi-file store actions', () => { ...@@ -356,7 +356,9 @@ describe('Multi-file store actions', () => {
type: 'blob', type: 'blob',
}) })
.then(() => { .then(() => {
expect(document.querySelector('.flash-alert')).not.toBeNull(); expect(document.querySelector('.flash-alert')?.textContent.trim()).toEqual(
`The name "${f.name}" is already taken in this directory.`,
);
done(); done();
}) })
......
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