Commit 7d742a21 authored by Phil Hughes's avatar Phil Hughes Committed by Gary Holtz

Hide the base version if the HEAD is available

parent ece24655
......@@ -22,7 +22,8 @@ export const diffCompareDropdownTargetVersions = (state, getters) => {
version_index: DIFF_COMPARE_BASE_VERSION_INDEX,
href: state.mergeRequestDiff.base_version_path,
isBase: true,
selected: isBaseSelected,
selected:
isBaseSelected || (defaultMergeRefForDiffs && !state.mergeRequestDiff.head_version_path),
};
const headVersion = {
......@@ -44,8 +45,10 @@ export const diffCompareDropdownTargetVersions = (state, getters) => {
return [
...state.mergeRequestDiffs.slice(1).map(formatVersion),
defaultMergeRefForDiffs && baseVersion,
headVersion,
(!defaultMergeRefForDiffs ||
(defaultMergeRefForDiffs && !state.mergeRequestDiff.head_version_path)) &&
baseVersion,
state.mergeRequestDiff.head_version_path && headVersion,
].filter(a => a);
};
......
......@@ -74,9 +74,9 @@
- if Feature.enabled?(:default_merge_ref_for_diffs, @project)
- params = params.merge(diff_head: true)
= render "projects/merge_requests/tabs/pane", name: "diffs", id: "js-diffs-app", class: "diffs", data: { "is-locked": @merge_request.discussion_locked?,
endpoint: diffs_project_merge_request_path(@project, @merge_request, 'json', params,
endpoint: diffs_project_merge_request_path(@project, @merge_request, 'json', params),
endpoint_metadata: @endpoint_metadata_url,
endpoint_batch: diffs_batch_project_json_merge_request_path(@project, @merge_request, 'json', params,
endpoint_batch: diffs_batch_project_json_merge_request_path(@project, @merge_request, 'json', params),
endpoint_coverage: @coverage_path,
help_page_path: suggest_changes_help_path,
current_user_data: @current_user_data,
......
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