Commit 09799220 authored by Stan Hu's avatar Stan Hu

Trim extra period when merge error displayed

When a merge error happens, previously the UI displayed two periods:

```
Merge failed: Failed to squash. Should be done manually.. Please try
again.
```

This happened because the backend sent the error message, "Failed to
squash. Should be done manually.", while the frontend added an extra
period.

To avoid this issue, we now trim the period and add it in the sentence.
parent e3c1b6fb
......@@ -121,8 +121,14 @@ export default {
);
},
mergeError() {
let { mergeError } = this.mr;
if (mergeError && mergeError.slice(-1) === '.') {
mergeError = mergeError.slice(0, -1);
}
return sprintf(s__('mrWidget|Merge failed: %{mergeError}. Please try again.'), {
mergeError: this.mr.mergeError,
mergeError,
});
},
},
......
---
title: Trim extra period when merge error displayed
merge_request: 23737
author:
type: fixed
......@@ -152,7 +152,7 @@ describe 'Merge request > User merges when pipeline succeeds', :js do
before do
merge_request.update(
merge_user: merge_request.author,
merge_error: 'Something went wrong'
merge_error: 'Something went wrong.'
)
refresh
end
......@@ -162,7 +162,7 @@ describe 'Merge request > User merges when pipeline succeeds', :js do
wait_for_requests
page.within('.mr-section-container') do
expect(page).to have_content('Merge failed: Something went wrong')
expect(page).to have_content('Merge failed: Something went wrong. Please try again.')
end
end
end
......@@ -171,7 +171,7 @@ describe 'Merge request > User merges when pipeline succeeds', :js do
before do
merge_request.update(
merge_user: merge_request.author,
merge_error: 'Something went wrong'
merge_error: 'Something went wrong.'
)
refresh
end
......@@ -181,7 +181,7 @@ describe 'Merge request > User merges when pipeline succeeds', :js do
wait_for_requests
page.within('.mr-section-container') do
expect(page).to have_content('Merge failed: Something went wrong')
expect(page).to have_content('Merge failed: Something went wrong. Please try again.')
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