Commit 81a52c27 authored by Phil Hughes's avatar Phil Hughes

Correctly show rebase state in MR widget

Correctly shows the rebase state even if a merge requests pipeline
has failed.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/45942
parent 6bd83fab
......@@ -13,6 +13,8 @@ export default function deviseState(data) {
return stateKey.conflicts;
} else if (data.work_in_progress) {
return stateKey.workInProgress;
} else if (this.shouldBeRebased) {
return stateKey.rebase;
} else if (this.onlyAllowMergeIfPipelineSucceeds && this.isPipelineFailed) {
return stateKey.pipelineFailed;
} else if (this.hasMergeableDiscussionsState) {
......@@ -25,8 +27,6 @@ export default function deviseState(data) {
return this.mergeError ? stateKey.autoMergeFailed : stateKey.mergeWhenPipelineSucceeds;
} else if (!this.canMerge) {
return stateKey.notAllowedToMerge;
} else if (this.shouldBeRebased) {
return stateKey.rebase;
} else if (this.canBeMerged) {
return stateKey.readyToMerge;
}
......
---
title: Fixed rebase button not showing in merge request widget
merge_request:
author:
type: fixed
......@@ -76,4 +76,28 @@ describe('getStateKey', () => {
expect(bound()).toEqual('archived');
});
it('returns rebased state key', () => {
const context = {
mergeStatus: 'checked',
mergeWhenPipelineSucceeds: false,
canMerge: true,
onlyAllowMergeIfPipelineSucceeds: true,
isPipelineFailed: true,
hasMergeableDiscussionsState: false,
isPipelineBlocked: false,
canBeMerged: false,
shouldBeRebased: true,
};
const data = {
project_archived: false,
branch_missing: false,
commits_count: 2,
has_conflicts: false,
work_in_progress: false,
};
const bound = getStateKey.bind(context, data);
expect(bound()).toEqual('rebase');
});
});
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