diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2019-01-25 09:36:50 +0000 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2019-01-25 09:36:50 +0000 |
commit | e055f7d3caa2b4ba9e9d752b9f846c1c9b674c44 (patch) | |
tree | 18749697207c3d36aa7a80f2ce3f4d58e8fc250e | |
parent | d42762ce2cea606d8a24b8246a7270ec253215f2 (diff) | |
parent | f10d75ecf6eaa568fc46a36a965c1d654a8317ef (diff) | |
download | gitlab-ce-e055f7d3caa2b4ba9e9d752b9f846c1c9b674c44.tar.gz |
Merge branch 'diff-fix-folder-path-commas' into 'master'
Fixed diff tree folders being rendered incorrectly
See merge request gitlab-org/gitlab-ce!24635
-rw-r--r-- | app/assets/javascripts/diffs/store/utils.js | 5 | ||||
-rw-r--r-- | app/assets/stylesheets/pages/diff.scss | 4 | ||||
-rw-r--r-- | spec/javascripts/diffs/store/utils_spec.js | 52 |
3 files changed, 57 insertions, 4 deletions
diff --git a/app/assets/javascripts/diffs/store/utils.js b/app/assets/javascripts/diffs/store/utils.js index 09afacc24df..effb6202327 100644 --- a/app/assets/javascripts/diffs/store/utils.js +++ b/app/assets/javascripts/diffs/store/utils.js @@ -1,5 +1,6 @@ import _ from 'underscore'; import { diffModes } from '~/ide/constants'; +import { truncatePathMiddleToLength } from '~/lib/utils/text_utility'; import { LINE_POSITION_LEFT, LINE_POSITION_RIGHT, @@ -306,7 +307,7 @@ export const getLowestSingleFolder = folder => { if (shouldGetFolder) { const firstFolder = getFolder(file); - path.push(firstFolder.path); + path.push(...firstFolder.path); tree.push(...firstFolder.tree); } @@ -321,7 +322,7 @@ export const getLowestSingleFolder = folder => { const { path, tree } = getFolder(folder, [folder.name]); return { - path: path.join('/'), + path: truncatePathMiddleToLength(path.join('/'), 40), treeAcc: tree.length ? tree[tree.length - 1].tree : null, }; }; diff --git a/app/assets/stylesheets/pages/diff.scss b/app/assets/stylesheets/pages/diff.scss index 43486fad633..02aac58a475 100644 --- a/app/assets/stylesheets/pages/diff.scss +++ b/app/assets/stylesheets/pages/diff.scss @@ -1029,7 +1029,7 @@ position: sticky; $top-pos: $header-height + $mr-tabs-height + $mr-version-controls-height + 10px; top: $header-height + $mr-tabs-height + $mr-version-controls-height + 10px; - max-height: calc(100vh - $top-pos); + max-height: calc(100vh - #{$top-pos}); padding-right: $gl-padding; .file-row { @@ -1040,7 +1040,7 @@ .with-performance-bar & { $performance-bar-top-pos: $performance-bar-height + $top-pos; top: $performance-bar-top-pos; - max-height: calc(100vh - $performance-bar-top-pos); + max-height: calc(100vh - #{$performance-bar-top-pos}); } } diff --git a/spec/javascripts/diffs/store/utils_spec.js b/spec/javascripts/diffs/store/utils_spec.js index 3641946518b..c5e413a29d8 100644 --- a/spec/javascripts/diffs/store/utils_spec.js +++ b/spec/javascripts/diffs/store/utils_spec.js @@ -667,6 +667,47 @@ describe('DiffsStoreUtils', () => { }, { type: 'tree', + name: 'ee', + tree: [ + { + type: 'tree', + name: 'lib', + tree: [ + { + type: 'tree', + name: 'ee', + tree: [ + { + type: 'tree', + name: 'gitlab', + tree: [ + { + type: 'tree', + name: 'checks', + tree: [ + { + type: 'tree', + name: 'longtreenametomakepath', + tree: [ + { + type: 'blob', + name: 'diff_check.rb', + tree: [], + }, + ], + }, + ], + }, + ], + }, + ], + }, + ], + }, + ], + }, + { + type: 'tree', name: 'spec', tree: [ { @@ -698,6 +739,17 @@ describe('DiffsStoreUtils', () => { }, { type: 'tree', + name: 'ee/lib/…/…/…/longtreenametomakepath', + tree: [ + { + name: 'diff_check.rb', + tree: [], + type: 'blob', + }, + ], + }, + { + type: 'tree', name: 'spec', tree: [ { |