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
3996bd75
Commit
3996bd75
authored
Nov 27, 2020
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed failing diffs action specs
Stubbed feature flag in the ruby specs
parent
cca0b3be
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
23 additions
and
6 deletions
+23
-6
lib/gitlab/diff/file_collection/merge_request_diff_batch.rb
lib/gitlab/diff/file_collection/merge_request_diff_batch.rb
+7
-4
spec/controllers/projects/merge_requests/diffs_controller_spec.rb
...trollers/projects/merge_requests/diffs_controller_spec.rb
+4
-0
spec/features/merge_request/user_sees_versions_spec.rb
spec/features/merge_request/user_sees_versions_spec.rb
+2
-0
spec/frontend/diffs/store/actions_spec.js
spec/frontend/diffs/store/actions_spec.js
+2
-2
spec/models/merge_request_diff_spec.rb
spec/models/merge_request_diff_spec.rb
+4
-0
spec/serializers/paginated_diff_entity_spec.rb
spec/serializers/paginated_diff_entity_spec.rb
+4
-0
No files found.
lib/gitlab/diff/file_collection/merge_request_diff_batch.rb
View file @
3996bd75
...
@@ -62,6 +62,7 @@ module Gitlab
...
@@ -62,6 +62,7 @@ module Gitlab
@merge_request_diff
.
merge_request_diff_files
@merge_request_diff
.
merge_request_diff_files
end
end
# rubocop: disable CodeReuse/ActiveRecord
def
load_paginated_collection
(
batch_page
,
batch_size
,
diff_options
)
def
load_paginated_collection
(
batch_page
,
batch_size
,
diff_options
)
batch_page
||=
DEFAULT_BATCH_PAGE
batch_page
||=
DEFAULT_BATCH_PAGE
batch_size
=
[
batch_size
.
to_i
,
DEFAULT_BATCH_SIZE
].
min
batch_size
=
[
batch_size
.
to_i
,
DEFAULT_BATCH_SIZE
].
min
...
@@ -69,14 +70,16 @@ module Gitlab
...
@@ -69,14 +70,16 @@ module Gitlab
paths
=
diff_options
&
.
fetch
(
:paths
,
nil
)
paths
=
diff_options
&
.
fetch
(
:paths
,
nil
)
paginated_collection
=
if
batch_gradual_load?
paginated_collection
=
if
batch_gradual_load?
relation
.
offset
(
batch_page
).
limit
(
batch_size
)
relation
.
offset
(
batch_page
).
limit
(
batch_size
)
else
else
relation
.
page
(
batch_page
).
per
(
batch_size
)
relation
.
page
(
batch_page
).
per
(
batch_size
)
end
end
paginated_collection
=
paginated_collection
.
by_paths
(
paths
)
if
paths
paginated_collection
=
paginated_collection
.
by_paths
(
paths
)
if
paths
paginated_collection
paginated_collection
end
end
# rubocop: enable CodeReuse/ActiveRecord
def
batch_gradual_load?
def
batch_gradual_load?
Feature
.
enabled?
(
:diffs_gradual_load
,
@merge_request_diff
.
project
)
Feature
.
enabled?
(
:diffs_gradual_load
,
@merge_request_diff
.
project
)
...
...
spec/controllers/projects/merge_requests/diffs_controller_spec.rb
View file @
3996bd75
...
@@ -5,6 +5,10 @@ require 'spec_helper'
...
@@ -5,6 +5,10 @@ require 'spec_helper'
RSpec
.
describe
Projects
::
MergeRequests
::
DiffsController
do
RSpec
.
describe
Projects
::
MergeRequests
::
DiffsController
do
include
ProjectForksHelper
include
ProjectForksHelper
before
do
stub_feature_flags
(
diffs_gradual_load:
false
)
end
shared_examples
'404 for unexistent diffable'
do
shared_examples
'404 for unexistent diffable'
do
context
'when diffable does not exists'
do
context
'when diffable does not exists'
do
it
'returns 404'
do
it
'returns 404'
do
...
...
spec/features/merge_request/user_sees_versions_spec.rb
View file @
3996bd75
...
@@ -17,6 +17,8 @@ RSpec.describe 'Merge request > User sees versions', :js do
...
@@ -17,6 +17,8 @@ RSpec.describe 'Merge request > User sees versions', :js do
let!
(
:params
)
{
{}
}
let!
(
:params
)
{
{}
}
before
do
before
do
stub_feature_flags
(
diffs_gradual_load:
false
)
project
.
add_maintainer
(
user
)
project
.
add_maintainer
(
user
)
sign_in
(
user
)
sign_in
(
user
)
visit
diffs_project_merge_request_path
(
project
,
merge_request
,
params
)
visit
diffs_project_merge_request_path
(
project
,
merge_request
,
params
)
...
...
spec/frontend/diffs/store/actions_spec.js
View file @
3996bd75
...
@@ -159,10 +159,10 @@ describe('DiffsStoreActions', () => {
...
@@ -159,10 +159,10 @@ describe('DiffsStoreActions', () => {
.
onGet
(
.
onGet
(
mergeUrlParams
(
mergeUrlParams
(
{
{
per_page
:
DIFFS_PER_PAGE
,
w
:
'
1
'
,
w
:
'
1
'
,
view
:
'
inline
'
,
view
:
'
inline
'
,
page
:
1
,
page
:
1
,
per_page
:
DIFFS_PER_PAGE
,
},
},
endpointBatch
,
endpointBatch
,
),
),
...
@@ -171,10 +171,10 @@ describe('DiffsStoreActions', () => {
...
@@ -171,10 +171,10 @@ describe('DiffsStoreActions', () => {
.
onGet
(
.
onGet
(
mergeUrlParams
(
mergeUrlParams
(
{
{
per_page
:
DIFFS_PER_PAGE
,
w
:
'
1
'
,
w
:
'
1
'
,
view
:
'
inline
'
,
view
:
'
inline
'
,
page
:
2
,
page
:
2
,
per_page
:
DIFFS_PER_PAGE
,
},
},
endpointBatch
,
endpointBatch
,
),
),
...
...
spec/models/merge_request_diff_spec.rb
View file @
3996bd75
...
@@ -9,6 +9,10 @@ RSpec.describe MergeRequestDiff do
...
@@ -9,6 +9,10 @@ RSpec.describe MergeRequestDiff do
let
(
:diff_with_commits
)
{
create
(
:merge_request
).
merge_request_diff
}
let
(
:diff_with_commits
)
{
create
(
:merge_request
).
merge_request_diff
}
before
do
stub_feature_flags
(
diffs_gradual_load:
false
)
end
describe
'validations'
do
describe
'validations'
do
subject
{
diff_with_commits
}
subject
{
diff_with_commits
}
...
...
spec/serializers/paginated_diff_entity_spec.rb
View file @
3996bd75
...
@@ -19,6 +19,10 @@ RSpec.describe PaginatedDiffEntity do
...
@@ -19,6 +19,10 @@ RSpec.describe PaginatedDiffEntity do
subject
{
entity
.
as_json
}
subject
{
entity
.
as_json
}
before
do
stub_feature_flags
(
diffs_gradual_load:
false
)
end
it
'exposes diff_files'
do
it
'exposes diff_files'
do
expect
(
subject
[
:diff_files
]).
to
be_present
expect
(
subject
[
:diff_files
]).
to
be_present
end
end
...
...
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