diff options
Diffstat (limited to 'app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_conflicts.vue')
-rw-r--r-- | app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_conflicts.vue | 54 |
1 files changed, 13 insertions, 41 deletions
diff --git a/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_conflicts.vue b/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_conflicts.vue index d60d3cfc9ea..8e1b18c63a4 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_conflicts.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_conflicts.vue @@ -1,6 +1,5 @@ <script> import { GlButton, GlSkeletonLoader } from '@gitlab/ui'; -import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import mergeRequestQueryVariablesMixin from '../../mixins/merge_request_query_variables'; import userPermissionsQuery from '../../queries/permissions.query.graphql'; import conflictsStateQuery from '../../queries/states/conflicts.query.graphql'; @@ -13,23 +12,17 @@ export default { GlButton, StateContainer, }, - mixins: [glFeatureFlagMixin(), mergeRequestQueryVariablesMixin], + mixins: [mergeRequestQueryVariablesMixin], apollo: { userPermissions: { query: userPermissionsQuery, - skip() { - return !this.glFeatures.mergeRequestWidgetGraphql; - }, variables() { return this.mergeRequestQueryVariables; }, update: (data) => data.project.mergeRequest.userPermissions, }, - stateData: { + state: { query: conflictsStateQuery, - skip() { - return !this.glFeatures.mergeRequestWidgetGraphql; - }, variables() { return this.mergeRequestQueryVariables; }, @@ -47,40 +40,19 @@ export default { data() { return { userPermissions: {}, - stateData: {}, + state: {}, }; }, computed: { isLoading() { - return ( - this.glFeatures.mergeRequestWidgetGraphql && - this.$apollo.queries.userPermissions.loading && - this.$apollo.queries.stateData.loading - ); - }, - canPushToSourceBranch() { - if (this.glFeatures.mergeRequestWidgetGraphql) { - return this.userPermissions.pushToSourceBranch; - } - - return this.mr.canPushToSourceBranch; - }, - canMerge() { - if (this.glFeatures.mergeRequestWidgetGraphql) { - return this.userPermissions.canMerge; - } - - return this.mr.canMerge; - }, - shouldBeRebased() { - if (this.glFeatures.mergeRequestWidgetGraphql) { - return this.stateData.shouldBeRebased; - } - - return this.mr.shouldBeRebased; + return this.$apollo.queries.userPermissions.loading && this.$apollo.queries.state.loading; }, showResolveButton() { - return this.mr.conflictResolutionPath && this.canPushToSourceBranch; + return ( + this.mr.conflictResolutionPath && + this.userPermissions.pushToSourceBranch && + !this.state.sourceBranchProtected + ); }, }, }; @@ -95,7 +67,7 @@ export default { </gl-skeleton-loader> </template> <template v-if="!isLoading"> - <span v-if="shouldBeRebased" class="bold gl-ml-0! gl-text-body!"> + <span v-if="state.shouldBeRebased" class="bold gl-ml-0! gl-text-body!"> {{ s__(`mrWidget|Merge blocked: fast-forward merge is not possible. To merge this request, first rebase locally.`) @@ -104,7 +76,7 @@ export default { <template v-else> <span class="bold gl-ml-0! gl-text-body! gl-flex-grow-1 gl-w-full gl-md-w-auto gl-mr-2"> {{ s__('mrWidget|Merge blocked: merge conflicts must be resolved.') }} - <span v-if="!canMerge"> + <span v-if="!userPermissions.canMerge"> {{ s__( `mrWidget|Users who can write to the source or target branches can resolve the conflicts.`, @@ -114,9 +86,9 @@ export default { </span> </template> </template> - <template v-if="!isLoading && !shouldBeRebased" #actions> + <template v-if="!isLoading && !state.shouldBeRebased" #actions> <gl-button - v-if="canMerge" + v-if="userPermissions.canMerge" size="small" variant="confirm" category="secondary" |