Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
b1505c50
Commit
b1505c50
authored
Dec 20, 2019
by
Igor Drozdov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Execute Gitaly LFS call once when Vue file enabled
We don't need this call since we fetch it using GraphQL
parent
8fc0d79a
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
70 additions
and
3 deletions
+70
-3
app/controllers/projects/tree_controller.rb
app/controllers/projects/tree_controller.rb
+2
-1
app/controllers/projects_controller.rb
app/controllers/projects_controller.rb
+5
-2
changelogs/unreleased/id-call-lfs-once-when-vue-file-list-enabled.yml
...nreleased/id-call-lfs-once-when-vue-file-list-enabled.yml
+5
-0
spec/controllers/projects/tree_controller_spec.rb
spec/controllers/projects/tree_controller_spec.rb
+28
-0
spec/controllers/projects_controller_spec.rb
spec/controllers/projects_controller_spec.rb
+30
-0
No files found.
app/controllers/projects/tree_controller.rb
View file @
b1505c50
...
@@ -28,7 +28,8 @@ class Projects::TreeController < Projects::ApplicationController
...
@@ -28,7 +28,8 @@ class Projects::TreeController < Projects::ApplicationController
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
do
format
.
html
do
lfs_blob_ids
lfs_blob_ids
if
Feature
.
disabled?
(
:vue_file_list
,
@project
)
@last_commit
=
@repository
.
last_commit_for_path
(
@commit
.
id
,
@tree
.
path
)
||
@commit
@last_commit
=
@repository
.
last_commit_for_path
(
@commit
.
id
,
@tree
.
path
)
||
@commit
end
end
end
end
...
...
app/controllers/projects_controller.rb
View file @
b1505c50
...
@@ -21,8 +21,7 @@ class ProjectsController < Projects::ApplicationController
...
@@ -21,8 +21,7 @@ class ProjectsController < Projects::ApplicationController
before_action
:assign_ref_vars
,
if:
->
{
action_name
==
'show'
&&
repo_exists?
}
before_action
:assign_ref_vars
,
if:
->
{
action_name
==
'show'
&&
repo_exists?
}
before_action
:tree
,
before_action
:tree
,
if:
->
{
action_name
==
'show'
&&
repo_exists?
&&
project_view_files?
}
if:
->
{
action_name
==
'show'
&&
repo_exists?
&&
project_view_files?
}
before_action
:lfs_blob_ids
,
before_action
:lfs_blob_ids
,
if: :show_blob_ids?
,
only: :show
if:
->
{
action_name
==
'show'
&&
repo_exists?
&&
project_view_files?
}
before_action
:project_export_enabled
,
only:
[
:export
,
:download_export
,
:remove_export
,
:generate_new_export
]
before_action
:project_export_enabled
,
only:
[
:export
,
:download_export
,
:remove_export
,
:generate_new_export
]
before_action
:present_project
,
only:
[
:edit
]
before_action
:present_project
,
only:
[
:edit
]
before_action
:authorize_download_code!
,
only:
[
:refs
]
before_action
:authorize_download_code!
,
only:
[
:refs
]
...
@@ -296,6 +295,10 @@ class ProjectsController < Projects::ApplicationController
...
@@ -296,6 +295,10 @@ class ProjectsController < Projects::ApplicationController
private
private
def
show_blob_ids?
repo_exists?
&&
project_view_files?
&&
Feature
.
disabled?
(
:vue_file_list
,
@project
)
end
# Render project landing depending of which features are available
# Render project landing depending of which features are available
# So if page is not available in the list it renders the next page
# So if page is not available in the list it renders the next page
#
#
...
...
changelogs/unreleased/id-call-lfs-once-when-vue-file-list-enabled.yml
0 → 100644
View file @
b1505c50
---
title
:
Execute Gitaly LFS call once when Vue file enabled
merge_request
:
22168
author
:
type
:
performance
spec/controllers/projects/tree_controller_spec.rb
View file @
b1505c50
...
@@ -89,6 +89,34 @@ describe Projects::TreeController do
...
@@ -89,6 +89,34 @@ describe Projects::TreeController do
end
end
end
end
describe
"GET show"
do
context
'lfs_blob_ids instance variable'
do
let
(
:id
)
{
'master'
}
context
'with vue tree view enabled'
do
before
do
get
(
:show
,
params:
{
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
,
id:
id
})
end
it
'is not set'
do
expect
(
assigns
[
:lfs_blob_ids
]).
to
be_nil
end
end
context
'with vue tree view disabled'
do
before
do
stub_feature_flags
(
vue_file_list:
false
)
get
(
:show
,
params:
{
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
,
id:
id
})
end
it
'is set'
do
expect
(
assigns
[
:lfs_blob_ids
]).
not_to
be_nil
end
end
end
end
describe
'GET show with whitespace in ref'
do
describe
'GET show with whitespace in ref'
do
render_views
render_views
...
...
spec/controllers/projects_controller_spec.rb
View file @
b1505c50
...
@@ -289,6 +289,36 @@ describe ProjectsController do
...
@@ -289,6 +289,36 @@ describe ProjectsController do
.
not_to
exceed_query_limit
(
2
).
for_query
(
expected_query
)
.
not_to
exceed_query_limit
(
2
).
for_query
(
expected_query
)
end
end
end
end
context
'lfs_blob_ids instance variable'
do
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
before
do
sign_in
(
user
)
end
context
'with vue tree view enabled'
do
before
do
get
:show
,
params:
{
namespace_id:
project
.
namespace
,
id:
project
}
end
it
'is not set'
do
expect
(
assigns
[
:lfs_blob_ids
]).
to
be_nil
end
end
context
'with vue tree view disabled'
do
before
do
stub_feature_flags
(
vue_file_list:
false
)
get
:show
,
params:
{
namespace_id:
project
.
namespace
,
id:
project
}
end
it
'is set'
do
expect
(
assigns
[
:lfs_blob_ids
]).
not_to
be_nil
end
end
end
end
end
describe
'GET edit'
do
describe
'GET edit'
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment