Commit 1afe8010 authored by Phil Hughes's avatar Phil Hughes

Fix show full diff file not working with unified diffs

With unified diffs we only care about the inline diffs
However, when clicking show full file it ended up
creating a parallel array of diff lines.
parent a36cb945
......@@ -10,6 +10,7 @@ import {
GlDropdown,
GlDropdownItem,
GlDropdownDivider,
GlLoadingIcon,
} from '@gitlab/ui';
import ClipboardButton from '~/vue_shared/components/clipboard_button.vue';
import FileIcon from '~/vue_shared/components/file_icon.vue';
......@@ -32,6 +33,7 @@ export default {
GlDropdown,
GlDropdownItem,
GlDropdownDivider,
GlLoadingIcon,
},
directives: {
GlTooltip: GlTooltipDirective,
......@@ -365,8 +367,10 @@ export default {
<gl-dropdown-item
v-if="!diffFile.is_fully_expanded"
ref="expandDiffToFullFileButton"
:disabled="diffFile.isLoadingFullFile"
@click="toggleFullDiff(diffFile.file_path)"
>
<gl-loading-icon v-if="diffFile.isLoadingFullFile" inline />
{{ expandDiffToFullFileTitle }}
</gl-dropdown-item>
</template>
......
......@@ -536,15 +536,20 @@ export const setExpandedDiffLines = ({ commit, state }, { file, data }) => {
}),
}),
};
const unifiedDiffLinesEnabled = window.gon?.features?.unifiedDiffLines;
const currentDiffLinesKey =
state.diffViewType === INLINE_DIFF_VIEW_TYPE ? INLINE_DIFF_LINES_KEY : PARALLEL_DIFF_LINES_KEY;
state.diffViewType === INLINE_DIFF_VIEW_TYPE || unifiedDiffLinesEnabled
? INLINE_DIFF_LINES_KEY
: PARALLEL_DIFF_LINES_KEY;
const hiddenDiffLinesKey =
state.diffViewType === INLINE_DIFF_VIEW_TYPE ? PARALLEL_DIFF_LINES_KEY : INLINE_DIFF_LINES_KEY;
commit(types.SET_HIDDEN_VIEW_DIFF_FILE_LINES, {
filePath: file.file_path,
lines: expandedDiffLines[hiddenDiffLinesKey],
});
if (!unifiedDiffLinesEnabled) {
commit(types.SET_HIDDEN_VIEW_DIFF_FILE_LINES, {
filePath: file.file_path,
lines: expandedDiffLines[hiddenDiffLinesKey],
});
}
if (expandedDiffLines[currentDiffLinesKey].length > MAX_RENDERING_DIFF_LINES) {
let index = START_RENDERING_INDEX;
......
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