Commit 0dfb80f3 authored by Phil Hughes's avatar Phil Hughes

Merge branch '30141-improve-merge-failed-error-fe' into 'master'

Improve merge failed error (FE)

See merge request gitlab-org/gitlab!52555
parents 664f7196 a872e4fc
<script> <script>
import { GlButton } from '@gitlab/ui'; import { GlButton } from '@gitlab/ui';
import { n__ } from '~/locale'; import { sprintf, s__, n__ } from '~/locale';
import { stripHtml } from '~/lib/utils/text_utility'; import { stripHtml } from '~/lib/utils/text_utility';
import statusIcon from '../mr_widget_status_icon.vue'; import statusIcon from '../mr_widget_status_icon.vue';
import eventHub from '../../event_hub'; import eventHub from '../../event_hub';
...@@ -31,7 +31,15 @@ export default { ...@@ -31,7 +31,15 @@ export default {
computed: { computed: {
mergeError() { mergeError() {
return this.mr.mergeError ? stripHtml(this.mr.mergeError, ' ').trim() : ''; const mergeError = this.mr.mergeError ? stripHtml(this.mr.mergeError, ' ').trim() : '';
return sprintf(
s__('mrWidget|%{mergeError}.'),
{
mergeError,
},
false,
);
}, },
timerText() { timerText() {
return n__( return n__(
......
...@@ -191,7 +191,7 @@ export default { ...@@ -191,7 +191,7 @@ export default {
} }
return sprintf( return sprintf(
s__('mrWidget|Merge failed: %{mergeError}. Please try again.'), s__('mrWidget|%{mergeError}. Try again.'),
{ {
mergeError, mergeError,
}, },
......
---
title: Improve merge failed error
merge_request: 52555
author:
type: changed
...@@ -34081,6 +34081,12 @@ msgstr "" ...@@ -34081,6 +34081,12 @@ msgstr ""
msgid "mrWidget|%{link_start}Learn more about resolving conflicts%{link_end}" msgid "mrWidget|%{link_start}Learn more about resolving conflicts%{link_end}"
msgstr "" msgstr ""
msgid "mrWidget|%{mergeError}."
msgstr ""
msgid "mrWidget|%{mergeError}. Try again."
msgstr ""
msgid "mrWidget|%{metricsLinkStart} Memory %{metricsLinkEnd} usage %{emphasisStart} decreased %{emphasisEnd} from %{memoryFrom}MB to %{memoryTo}MB" msgid "mrWidget|%{metricsLinkStart} Memory %{metricsLinkEnd} usage %{emphasisStart} decreased %{emphasisEnd} from %{memoryFrom}MB to %{memoryTo}MB"
msgstr "" msgstr ""
...@@ -34207,9 +34213,6 @@ msgstr "" ...@@ -34207,9 +34213,6 @@ msgstr ""
msgid "mrWidget|Merge failed." msgid "mrWidget|Merge failed."
msgstr "" msgstr ""
msgid "mrWidget|Merge failed: %{mergeError}. Please try again."
msgstr ""
msgid "mrWidget|Merge locally" msgid "mrWidget|Merge locally"
msgstr "" msgstr ""
......
...@@ -145,7 +145,7 @@ RSpec.describe 'Merge request > User merges when pipeline succeeds', :js do ...@@ -145,7 +145,7 @@ RSpec.describe 'Merge request > User merges when pipeline succeeds', :js do
before do before do
merge_request.update!( merge_request.update!(
merge_user: merge_request.author, merge_user: merge_request.author,
merge_error: 'Something went wrong.' merge_error: 'Something went wrong'
) )
refresh refresh
end end
...@@ -155,7 +155,7 @@ RSpec.describe 'Merge request > User merges when pipeline succeeds', :js do ...@@ -155,7 +155,7 @@ RSpec.describe 'Merge request > User merges when pipeline succeeds', :js do
wait_for_requests wait_for_requests
page.within('.mr-section-container') do page.within('.mr-section-container') do
expect(page).to have_content('Merge failed: Something went wrong. Please try again.') expect(page).to have_content('Something went wrong. Try again.')
end end
end end
end end
...@@ -174,7 +174,7 @@ RSpec.describe 'Merge request > User merges when pipeline succeeds', :js do ...@@ -174,7 +174,7 @@ RSpec.describe 'Merge request > User merges when pipeline succeeds', :js do
wait_for_requests wait_for_requests
page.within('.mr-section-container') do page.within('.mr-section-container') do
expect(page).to have_content('Merge failed: Something went wrong. Please try again.') expect(page).to have_content('Something went wrong. Try again.')
end end
end end
end end
......
...@@ -319,7 +319,7 @@ RSpec.describe 'Merge request > User sees merge widget', :js do ...@@ -319,7 +319,7 @@ RSpec.describe 'Merge request > User sees merge widget', :js do
wait_for_requests wait_for_requests
page.within('.mr-section-container') do page.within('.mr-section-container') do
expect(page).to have_content('Merge failed: Something went wrong') expect(page).to have_content('Something went wrong.')
end end
end end
end end
...@@ -340,7 +340,7 @@ RSpec.describe 'Merge request > User sees merge widget', :js do ...@@ -340,7 +340,7 @@ RSpec.describe 'Merge request > User sees merge widget', :js do
wait_for_requests wait_for_requests
page.within('.mr-section-container') do page.within('.mr-section-container') do
expect(page).to have_content('Merge failed: Something went wrong') expect(page).to have_content('Something went wrong.')
end end
end end
end end
......
...@@ -54,7 +54,7 @@ describe('MRWidgetFailedToMerge', () => { ...@@ -54,7 +54,7 @@ describe('MRWidgetFailedToMerge', () => {
Vue.nextTick() Vue.nextTick()
.then(() => { .then(() => {
expect(vm.mergeError).toBe('contains line breaks'); expect(vm.mergeError).toBe('contains line breaks.');
}) })
.then(done) .then(done)
.catch(done.fail); .catch(done.fail);
...@@ -120,7 +120,7 @@ describe('MRWidgetFailedToMerge', () => { ...@@ -120,7 +120,7 @@ describe('MRWidgetFailedToMerge', () => {
it('renders given error', () => { it('renders given error', () => {
expect(vm.$el.querySelector('.has-error-message').textContent.trim()).toEqual( expect(vm.$el.querySelector('.has-error-message').textContent.trim()).toEqual(
'Merge error happened', 'Merge error happened.',
); );
}); });
......
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