Commit f0d69f67 authored by Miguel Rincon's avatar Miguel Rincon

Merge branch 'aqualls-ui-merge-conflicts' into 'master'

Provide better UI message for merge conflicts

See merge request gitlab-org/gitlab!74655
parents 9bb39fdb 650ef4e7
...@@ -117,11 +117,12 @@ export default { ...@@ -117,11 +117,12 @@ export default {
</span> </span>
<template v-else> <template v-else>
<span class="bold"> <span class="bold">
{{ s__('mrWidget|There are merge conflicts') }}<span v-if="!canMerge">.</span> {{ s__('mrWidget|Merge blocked: merge conflicts must be resolved.') }}
<span v-if="!canMerge"> <span v-if="!canMerge">
{{ {{
s__(`mrWidget|Resolve these conflicts or ask someone s__(
with write access to this repository to merge it locally`) `mrWidget|Users who can write to the source or target branches can resolve the conflicts.`,
)
}} }}
</span> </span>
</span> </span>
......
...@@ -41549,6 +41549,9 @@ msgstr "" ...@@ -41549,6 +41549,9 @@ msgstr ""
msgid "mrWidget|Merge blocked: fast-forward merge is not possible. To merge this request, first rebase locally." msgid "mrWidget|Merge blocked: fast-forward merge is not possible. To merge this request, first rebase locally."
msgstr "" msgstr ""
msgid "mrWidget|Merge blocked: merge conflicts must be resolved."
msgstr ""
msgid "mrWidget|Merge blocked: pipeline must succeed. It's waiting for a manual action to continue." msgid "mrWidget|Merge blocked: pipeline must succeed. It's waiting for a manual action to continue."
msgstr "" msgstr ""
...@@ -41627,9 +41630,6 @@ msgstr "" ...@@ -41627,9 +41630,6 @@ msgstr ""
msgid "mrWidget|Resolve conflicts" msgid "mrWidget|Resolve conflicts"
msgstr "" msgstr ""
msgid "mrWidget|Resolve these conflicts or ask someone with write access to this repository to merge it locally"
msgstr ""
msgid "mrWidget|Revert" msgid "mrWidget|Revert"
msgstr "" msgstr ""
...@@ -41675,9 +41675,6 @@ msgstr "" ...@@ -41675,9 +41675,6 @@ msgstr ""
msgid "mrWidget|The source branch is being deleted" msgid "mrWidget|The source branch is being deleted"
msgstr "" msgstr ""
msgid "mrWidget|There are merge conflicts"
msgstr ""
msgid "mrWidget|This merge request failed to be merged automatically" msgid "mrWidget|This merge request failed to be merged automatically"
msgstr "" msgstr ""
...@@ -41690,6 +41687,9 @@ msgstr "" ...@@ -41690,6 +41687,9 @@ msgstr ""
msgid "mrWidget|To merge, a Jira issue key must be mentioned in the title or description." msgid "mrWidget|To merge, a Jira issue key must be mentioned in the title or description."
msgstr "" msgstr ""
msgid "mrWidget|Users who can write to the source or target branches can resolve the conflicts."
msgstr ""
msgid "mrWidget|What is a merge train?" msgid "mrWidget|What is a merge train?"
msgstr "" msgstr ""
......
...@@ -12,6 +12,14 @@ describe('MRWidgetConflicts', () => { ...@@ -12,6 +12,14 @@ describe('MRWidgetConflicts', () => {
const findResolveButton = () => wrapper.findByTestId('resolve-conflicts-button'); const findResolveButton = () => wrapper.findByTestId('resolve-conflicts-button');
const findMergeLocalButton = () => wrapper.findByTestId('merge-locally-button'); const findMergeLocalButton = () => wrapper.findByTestId('merge-locally-button');
const mergeConflictsText = 'Merge blocked: merge conflicts must be resolved.';
const fastForwardMergeText =
'Merge blocked: fast-forward merge is not possible. To merge this request, first rebase locally.';
const userCannotMergeText =
'Users who can write to the source or target branches can resolve the conflicts.';
const resolveConflictsBtnText = 'Resolve conflicts';
const mergeLocallyBtnText = 'Merge locally';
function createComponent(propsData = {}) { function createComponent(propsData = {}) {
wrapper = extendedWrapper( wrapper = extendedWrapper(
shallowMount(ConflictsComponent, { shallowMount(ConflictsComponent, {
...@@ -81,16 +89,16 @@ describe('MRWidgetConflicts', () => { ...@@ -81,16 +89,16 @@ describe('MRWidgetConflicts', () => {
}); });
it('should tell you about conflicts without bothering other people', () => { it('should tell you about conflicts without bothering other people', () => {
expect(wrapper.text()).toContain('There are merge conflicts'); expect(wrapper.text()).toContain(mergeConflictsText);
expect(wrapper.text()).not.toContain('ask someone with write access'); expect(wrapper.text()).not.toContain(userCannotMergeText);
}); });
it('should not allow you to resolve the conflicts', () => { it('should not allow you to resolve the conflicts', () => {
expect(wrapper.text()).not.toContain('Resolve conflicts'); expect(wrapper.text()).not.toContain(resolveConflictsBtnText);
}); });
it('should have merge buttons', () => { it('should have merge buttons', () => {
expect(findMergeLocalButton().text()).toContain('Merge locally'); expect(findMergeLocalButton().text()).toContain(mergeLocallyBtnText);
}); });
}); });
...@@ -107,17 +115,17 @@ describe('MRWidgetConflicts', () => { ...@@ -107,17 +115,17 @@ describe('MRWidgetConflicts', () => {
}); });
it('should tell you about conflicts', () => { it('should tell you about conflicts', () => {
expect(wrapper.text()).toContain('There are merge conflicts'); expect(wrapper.text()).toContain(mergeConflictsText);
expect(wrapper.text()).toContain('ask someone with write access'); expect(wrapper.text()).toContain(userCannotMergeText);
}); });
it('should allow you to resolve the conflicts', () => { it('should allow you to resolve the conflicts', () => {
expect(findResolveButton().text()).toContain('Resolve conflicts'); expect(findResolveButton().text()).toContain(resolveConflictsBtnText);
expect(findResolveButton().attributes('href')).toEqual(path); expect(findResolveButton().attributes('href')).toEqual(path);
}); });
it('should not have merge buttons', () => { it('should not have merge buttons', () => {
expect(wrapper.text()).not.toContain('Merge locally'); expect(wrapper.text()).not.toContain(mergeLocallyBtnText);
}); });
}); });
...@@ -134,17 +142,17 @@ describe('MRWidgetConflicts', () => { ...@@ -134,17 +142,17 @@ describe('MRWidgetConflicts', () => {
}); });
it('should tell you about conflicts without bothering other people', () => { it('should tell you about conflicts without bothering other people', () => {
expect(wrapper.text()).toContain('There are merge conflicts'); expect(wrapper.text()).toContain(mergeConflictsText);
expect(wrapper.text()).not.toContain('ask someone with write access'); expect(wrapper.text()).not.toContain(userCannotMergeText);
}); });
it('should allow you to resolve the conflicts', () => { it('should allow you to resolve the conflicts', () => {
expect(findResolveButton().text()).toContain('Resolve conflicts'); expect(findResolveButton().text()).toContain(resolveConflictsBtnText);
expect(findResolveButton().attributes('href')).toEqual(path); expect(findResolveButton().attributes('href')).toEqual(path);
}); });
it('should have merge buttons', () => { it('should have merge buttons', () => {
expect(findMergeLocalButton().text()).toContain('Merge locally'); expect(findMergeLocalButton().text()).toContain(mergeLocallyBtnText);
}); });
}); });
...@@ -158,9 +166,7 @@ describe('MRWidgetConflicts', () => { ...@@ -158,9 +166,7 @@ describe('MRWidgetConflicts', () => {
}, },
}); });
expect(wrapper.text().trim().replace(/\s\s+/g, ' ')).toContain( expect(wrapper.text().trim().replace(/\s\s+/g, ' ')).toContain(userCannotMergeText);
'ask someone with write access',
);
}); });
it('should not have action buttons', async () => { it('should not have action buttons', async () => {
...@@ -198,9 +204,7 @@ describe('MRWidgetConflicts', () => { ...@@ -198,9 +204,7 @@ describe('MRWidgetConflicts', () => {
}, },
}); });
expect(removeBreakLine(wrapper.text()).trim()).toContain( expect(removeBreakLine(wrapper.text()).trim()).toContain(fastForwardMergeText);
'Merge blocked: fast-forward merge is not possible. To merge this request, first rebase locally.',
);
}); });
}); });
...@@ -236,7 +240,7 @@ describe('MRWidgetConflicts', () => { ...@@ -236,7 +240,7 @@ describe('MRWidgetConflicts', () => {
}); });
it('should allow you to resolve the conflicts', () => { it('should allow you to resolve the conflicts', () => {
expect(findResolveButton().text()).toContain('Resolve conflicts'); expect(findResolveButton().text()).toContain(resolveConflictsBtnText);
expect(findResolveButton().attributes('href')).toEqual(TEST_HOST); expect(findResolveButton().attributes('href')).toEqual(TEST_HOST);
}); });
}); });
......
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