diff options
author | Phil Hughes <me@iamphill.com> | 2017-10-20 10:47:45 +0100 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-10-23 10:47:22 +0100 |
commit | 4699cf77b6a0f5261ae382ac1a55882424efe4fb (patch) | |
tree | 90ed6e103fc273625744ae40bf5957fa459e8e02 /app | |
parent | 4c186f99f2ce72dfe3cd3e64b84b5ea5761f1657 (diff) | |
download | gitlab-ce-4699cf77b6a0f5261ae382ac1a55882424efe4fb.tar.gz |
added feature spec
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/repo/helpers/repo_helper.js | 11 | ||||
-rw-r--r-- | app/controllers/projects/tree_controller.rb | 1 |
2 files changed, 8 insertions, 4 deletions
diff --git a/app/assets/javascripts/repo/helpers/repo_helper.js b/app/assets/javascripts/repo/helpers/repo_helper.js index 8b73a1020a0..9e53ffe9a6f 100644 --- a/app/assets/javascripts/repo/helpers/repo_helper.js +++ b/app/assets/javascripts/repo/helpers/repo_helper.js @@ -98,8 +98,8 @@ const RepoHelper = { .then((response) => { const data = response.data; if (response.headers && response.headers['page-title']) data.pageTitle = decodeURI(response.headers['page-title']); - if (response.headers && response.headers['is-root'] && !Store.isInitialRoot) { - Store.isRoot = convertPermissionToBoolean(response.headers['is-root']); + if (data.path && !Store.isInitialRoot) { + Store.isRoot = data.path === '/'; Store.isInitialRoot = Store.isRoot; } @@ -140,6 +140,10 @@ const RepoHelper = { addToDirectory(file, data) { const tree = file || Store; + + // TODO: Figure out why `popstate` is being trigger in the specs + if (!tree.files) return; + const files = tree.files.concat(this.dataToListOfFiles(data, file ? file.level + 1 : 0)); tree.files = files; @@ -236,7 +240,8 @@ const RepoHelper = { return Store.openedFiles.find(file => file.url === path); }, - loadingError() { + loadingError(e) { + console.log(e); Flash('Unable to load this content at this time.'); }, diff --git a/app/controllers/projects/tree_controller.rb b/app/controllers/projects/tree_controller.rb index 756f7e5df8c..f3719059f88 100644 --- a/app/controllers/projects/tree_controller.rb +++ b/app/controllers/projects/tree_controller.rb @@ -36,7 +36,6 @@ class Projects::TreeController < Projects::ApplicationController format.json do page_title @path.presence || _("Files"), @ref, @project.name_with_namespace - response.header['is-root'] = @path.empty? # n+1: https://gitlab.com/gitlab-org/gitlab-ce/issues/38261 Gitlab::GitalyClient.allow_n_plus_1_calls do |