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
This commit is contained in:
parent
6bd83fabff
commit
81a52c27c3
3 changed files with 31 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
|
5
changelogs/unreleased/mr-rebase-failing-tests.yml
Normal file
5
changelogs/unreleased/mr-rebase-failing-tests.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
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');
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue