Commit 36421944 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'ph/228922/fixMergeBlockedText' into 'master'

Fixed incorrect merge disabled text showing

See merge request gitlab-org/gitlab!82206
parents 3892e4e9 3a7a22c5
import { __ } from '~/locale'; import { __ } from '~/locale';
export const MERGE_DISABLED_TEXT = __( export const MERGE_DISABLED_TEXT = __('You can only merge once the items above are resolved.');
'Merge blocked: all merge request dependencies must be merged or closed.',
);
export const MERGE_DISABLED_SKIPPED_PIPELINE_TEXT = __( export const MERGE_DISABLED_SKIPPED_PIPELINE_TEXT = __(
"Merge blocked: pipeline must succeed. It's waiting for a manual job to continue.", "Merge blocked: pipeline must succeed. It's waiting for a manual job to continue.",
); );
......
...@@ -15,6 +15,9 @@ export const MERGE_DISABLED_TEXT_UNAPPROVED = s__( ...@@ -15,6 +15,9 @@ export const MERGE_DISABLED_TEXT_UNAPPROVED = s__(
export const PIPELINE_MUST_SUCCEED_CONFLICT_TEXT = __( export const PIPELINE_MUST_SUCCEED_CONFLICT_TEXT = __(
'A CI/CD pipeline must run and be successful before merge.', 'A CI/CD pipeline must run and be successful before merge.',
); );
export const MERGE_DISABLED_DEPENDENCIES_TEXT = __(
'Merge blocked: all merge request dependencies must be merged or closed.',
);
export default { export default {
computed: { computed: {
...@@ -31,15 +34,18 @@ export default { ...@@ -31,15 +34,18 @@ export default {
this.mr.preventMerge, this.mr.preventMerge,
); );
}, },
hasBlockingMergeRequests() {
return (
(this.mr.blockingMergeRequests?.visible_merge_requests?.merged?.length || 0) !==
(this.mr.blockingMergeRequests?.total_count || 0)
);
},
shouldShowMergeControls() { shouldShowMergeControls() {
if (this.glFeatures.restructuredMrWidget) { if (this.glFeatures.restructuredMrWidget) {
return this.restructuredWidgetShowMergeButtons; return this.restructuredWidgetShowMergeButtons;
} }
if ( if (this.hasBlockingMergeRequests) {
(this.mr.blockingMergeRequests?.visible_merge_requests?.merged?.length || 0) !==
(this.mr.blockingMergeRequests?.total_count || 0)
) {
return false; return false;
} }
...@@ -48,6 +54,8 @@ export default { ...@@ -48,6 +54,8 @@ export default {
mergeDisabledText() { mergeDisabledText() {
if (this.isApprovalNeeded) { if (this.isApprovalNeeded) {
return MERGE_DISABLED_TEXT_UNAPPROVED; return MERGE_DISABLED_TEXT_UNAPPROVED;
} else if (this.hasBlockingMergeRequests) {
return MERGE_DISABLED_DEPENDENCIES_TEXT;
} }
return base.computed.mergeDisabledText.call(this); return base.computed.mergeDisabledText.call(this);
......
...@@ -42156,6 +42156,9 @@ msgstr "" ...@@ -42156,6 +42156,9 @@ msgstr ""
msgid "You can only edit files when you are on a branch" msgid "You can only edit files when you are on a branch"
msgstr "" msgstr ""
msgid "You can only merge once the items above are resolved."
msgstr ""
msgid "You can only transfer the project to namespaces you manage." msgid "You can only transfer the project to namespaces you manage."
msgstr "" 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