Commit 92fb6061 authored by Phil Hughes's avatar Phil Hughes

Use simple if statement for setting baseVersion

parent 90d15e76
...@@ -16,15 +16,21 @@ export const diffCompareDropdownTargetVersions = (state, getters) => { ...@@ -16,15 +16,21 @@ export const diffCompareDropdownTargetVersions = (state, getters) => {
const diffHead = parseBoolean(diffHeadParam) || (!diffHeadParam && defaultMergeRefForDiffs); const diffHead = parseBoolean(diffHeadParam) || (!diffHeadParam && defaultMergeRefForDiffs);
const isBaseSelected = !state.startVersion && !diffHead; const isBaseSelected = !state.startVersion && !diffHead;
const isHeadSelected = !state.startVersion && diffHead; const isHeadSelected = !state.startVersion && diffHead;
let baseVersion = null;
const baseVersion = { if (
versionName: state.targetBranchName, !defaultMergeRefForDiffs ||
version_index: DIFF_COMPARE_BASE_VERSION_INDEX, (defaultMergeRefForDiffs && !state.mergeRequestDiff.head_version_path)
href: state.mergeRequestDiff.base_version_path, ) {
isBase: true, baseVersion = {
selected: versionName: state.targetBranchName,
isBaseSelected || (defaultMergeRefForDiffs && !state.mergeRequestDiff.head_version_path), version_index: DIFF_COMPARE_BASE_VERSION_INDEX,
}; href: state.mergeRequestDiff.base_version_path,
isBase: true,
selected:
isBaseSelected || (defaultMergeRefForDiffs && !state.mergeRequestDiff.head_version_path),
};
}
const headVersion = { const headVersion = {
versionName: state.targetBranchName, versionName: state.targetBranchName,
...@@ -45,9 +51,7 @@ export const diffCompareDropdownTargetVersions = (state, getters) => { ...@@ -45,9 +51,7 @@ export const diffCompareDropdownTargetVersions = (state, getters) => {
return [ return [
...state.mergeRequestDiffs.slice(1).map(formatVersion), ...state.mergeRequestDiffs.slice(1).map(formatVersion),
(!defaultMergeRefForDiffs || baseVersion,
(defaultMergeRefForDiffs && !state.mergeRequestDiff.head_version_path)) &&
baseVersion,
state.mergeRequestDiff.head_version_path && headVersion, state.mergeRequestDiff.head_version_path && headVersion,
].filter(a => a); ].filter(a => a);
}; };
......
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