Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2016-08-23 23:50:54 +0300
committerRuben Davila <rdavila84@gmail.com>2016-08-24 00:07:07 +0300
commit55a30d422aa0684a60f02b4de29695bde93c300f (patch)
tree39df2ef11a50f66786ac1c61707b9ae46c9fd527
parent346e677ef9db2a27c3ee69d420563ecc564e5afe (diff)
Merge branch 'fix-file-links-on-project-page' into 'master'
Fix file links on project page Files view ## What does this MR do? Fix the project show page when the default view is set to Files so that the links work. ## Are there points in the code the reviewer needs to double check? I can't figure out what caused this to break :confused: ## What are the relevant issue numbers? Closes https://gitlab.com/gitlab-com/support-forum/issues/959. ## Does this MR meet the acceptance criteria? - [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added - [x] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md) (N/A) - [x] API support added (N/A) - Tests - [x] Added for this feature/bug - [ ] All builds are passing - [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides) - [x] Branch has no merge conflicts with `master` (if you do - rebase it please) - [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits) See merge request !5933
-rw-r--r--CHANGELOG4
-rw-r--r--app/controllers/projects_controller.rb9
-rw-r--r--spec/features/projects_spec.rb29
3 files changed, 41 insertions, 1 deletions
diff --git a/CHANGELOG b/CHANGELOG
index b879e5495d7..181fcb6d73e 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -2,6 +2,9 @@ Please view this file on the master branch, on stable branches it's out of date.
v 8.11.1 (unreleased)
+v 8.11.1 (unreleased)
+ - Fix file links on project page when default view is Files !5933
+
v 8.11.0
- Use test coverage value from the latest successful pipeline in badge. !5862
- Add test coverage report badge. !5708
@@ -180,6 +183,7 @@ v 8.10.3
- Fix importer for GitHub Pull Requests when a branch was removed. !5573
- Ignore invalid IPs in X-Forwarded-For when trusted proxies are configured. !5584
- Trim extra displayed carriage returns in diffs and files with CRLFs. !5588
+ - Fix label already exist error message in the right sidebar.
v 8.10.2
- User can now search branches by name. !5144
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index fc52cd2f367..2a6385c1029 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -5,7 +5,7 @@ class ProjectsController < Projects::ApplicationController
before_action :project, except: [:new, :create]
before_action :repository, except: [:new, :create]
before_action :assign_ref_vars, only: [:show], if: :repo_exists?
- before_action :tree, only: [:show], if: [:repo_exists?, :project_view_files?]
+ before_action :assign_tree_vars, only: [:show], if: [:repo_exists?, :project_view_files?]
# Authorize
before_action :authorize_admin_project!, only: [:edit, :update, :housekeeping, :download_export, :export, :remove_export, :generate_new_export]
@@ -332,4 +332,11 @@ class ProjectsController < Projects::ApplicationController
def get_id
project.repository.root_ref
end
+
+ # ExtractsPath will set @id = project.path on the show route, but it has to be the
+ # branch name for the tree view to work correctly.
+ def assign_tree_vars
+ @id = get_id
+ tree
+ end
end
diff --git a/spec/features/projects_spec.rb b/spec/features/projects_spec.rb
index 1b14c66fe28..e00d85904d5 100644
--- a/spec/features/projects_spec.rb
+++ b/spec/features/projects_spec.rb
@@ -115,6 +115,35 @@ feature 'Project', feature: true do
end
end
+ describe 'tree view (default view is set to Files)' do
+ let(:user) { create(:user, project_view: 'files') }
+ let(:project) { create(:forked_project_with_submodules) }
+
+ before do
+ project.team << [user, :master]
+ login_as user
+ visit namespace_project_path(project.namespace, project)
+ end
+
+ it 'has working links to files' do
+ click_link('PROCESS.md')
+
+ expect(page.status_code).to eq(200)
+ end
+
+ it 'has working links to directories' do
+ click_link('encoding')
+
+ expect(page.status_code).to eq(200)
+ end
+
+ it 'has working links to submodules' do
+ click_link('645f6c4c')
+
+ expect(page.status_code).to eq(200)
+ end
+ end
+
def remove_with_confirm(button_text, confirm_with)
click_button button_text
fill_in 'confirm_name_input', with: confirm_with