Commit a01ceaf7 authored by Enrique Alcántara's avatar Enrique Alcántara

Merge branch '330841-improve-merge-block-message-for-skipped-pipeline' into 'master'

Improve merge blocked text for skipped pipelines

See merge request gitlab-org/gitlab!72520
parents 31f768bb 94ab56ad
import { __ } from '~/locale';
export const MERGE_DISABLED_TEXT = __('You can only merge once the items above are resolved.');
export const MERGE_DISABLED_SKIPPED_PIPELINE_TEXT = __(
"Merge blocked: pipeline must succeed. It's waiting for a manual job to continue.",
);
export const PIPELINE_MUST_SUCCEED_CONFLICT_TEXT = __(
'A CI/CD pipeline must run and be successful before merge.',
);
export const PIPELINE_SKIPPED_STATUS = 'SKIPPED';
export default {
computed: {
......@@ -17,6 +21,10 @@ export default {
);
},
mergeDisabledText() {
if (this.pipeline?.status === PIPELINE_SKIPPED_STATUS) {
return MERGE_DISABLED_SKIPPED_PIPELINE_TEXT;
}
return MERGE_DISABLED_TEXT;
},
pipelineMustSucceedConflictText() {
......
......@@ -12,7 +12,9 @@ import {
} from '~/vue_merge_request_widget/constants';
import {
MERGE_DISABLED_TEXT,
MERGE_DISABLED_SKIPPED_PIPELINE_TEXT,
PIPELINE_MUST_SUCCEED_CONFLICT_TEXT,
PIPELINE_SKIPPED_STATUS,
} from '~/vue_merge_request_widget/mixins/ready_to_merge';
describe('ReadyToMerge', () => {
......@@ -345,18 +347,31 @@ describe('ReadyToMerge', () => {
describe('cannot merge', () => {
describe('when isMergeAllowed=false', () => {
beforeEach(() => {
it('should show merge blocked because of skipped pipeline text', () => {
factory({
isMergeAllowed: false,
availableAutoMergeStrategies: [],
pipeline: { id: 1, path: 'path/to/pipeline', status: PIPELINE_SKIPPED_STATUS },
});
expect(findResolveItemsMessage().text()).toBe(MERGE_DISABLED_SKIPPED_PIPELINE_TEXT);
});
it('should show cannot merge text', () => {
factory({
isMergeAllowed: false,
availableAutoMergeStrategies: [],
});
expect(findResolveItemsMessage().text()).toBe(MERGE_DISABLED_TEXT);
});
it('should show disabled merge button', () => {
factory({
isMergeAllowed: false,
availableAutoMergeStrategies: [],
});
const button = findMergeButton();
expect(button.exists()).toBe(true);
......
......@@ -21403,6 +21403,9 @@ msgstr ""
msgid "Merge blocked: new changes were just added."
msgstr ""
msgid "Merge blocked: pipeline must succeed. It's waiting for a manual job to continue."
msgstr ""
msgid "Merge blocked: the source branch must be rebased onto the target branch."
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