diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 15:09:35 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 15:09:35 +0300 |
commit | 76e4e8f1b0629f8af2c627ae34901df77073e3c9 (patch) | |
tree | f5744161137b5e8c5d0de992c7585828ce52676c /app/assets/javascripts/diffs | |
parent | 79347b42ae647fca1c1b2e514a93d36d422068d3 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/diffs')
-rw-r--r-- | app/assets/javascripts/diffs/store/utils.js | 2 | ||||
-rw-r--r-- | app/assets/javascripts/diffs/utils/diff_file.js | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/app/assets/javascripts/diffs/store/utils.js b/app/assets/javascripts/diffs/store/utils.js index f2028892a5f..4526a34a2bd 100644 --- a/app/assets/javascripts/diffs/store/utils.js +++ b/app/assets/javascripts/diffs/store/utils.js @@ -406,7 +406,7 @@ function deduplicateFilesList(files) { export function prepareDiffData({ diff, priorFiles = [], meta = false }) { const cleanedFiles = (diff.diff_files || []) - .map((file, index, allFiles) => prepareRawDiffFile({ file, allFiles, meta })) + .map((file, index, allFiles) => prepareRawDiffFile({ file, allFiles, meta, index })) .map(ensureBasicDiffFileLines) .map(prepareDiffFileLines) .map((file) => finalizeDiffFile(file)); diff --git a/app/assets/javascripts/diffs/utils/diff_file.js b/app/assets/javascripts/diffs/utils/diff_file.js index 54dcf70c491..a7251bfa775 100644 --- a/app/assets/javascripts/diffs/utils/diff_file.js +++ b/app/assets/javascripts/diffs/utils/diff_file.js @@ -50,7 +50,7 @@ function identifier(file) { export const isNotDiffable = (file) => file?.viewer?.name === viewerModes.not_diffable; -export function prepareRawDiffFile({ file, allFiles, meta = false }) { +export function prepareRawDiffFile({ file, allFiles, meta = false, index = -1 }) { const additionalProperties = { brokenSymlink: fileSymlinkInformation(file, allFiles), viewer: { @@ -66,6 +66,10 @@ export function prepareRawDiffFile({ file, allFiles, meta = false }) { additionalProperties.id = identifier(file); } + if (index >= 0 && Number(index) === index) { + additionalProperties.order = index; + } + return Object.assign(file, additionalProperties); } |