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
@merge_request_diff
.
merge_request_diff_files
end
# rubocop: disable CodeReuse/ActiveRecord
def
load_paginated_collection
(
batch_page
,
batch_size
,
diff_options
)
batch_page
||=
DEFAULT_BATCH_PAGE
batch_size
=
[
batch_size
.
to_i
,
DEFAULT_BATCH_SIZE
].
min
...
...
@@ -69,14 +70,16 @@ module Gitlab
paths
=
diff_options
&
.
fetch
(
:paths
,
nil
)
paginated_collection
=
if
batch_gradual_load?
relation
.
offset
(
batch_page
).
limit
(
batch_size
)
else
relation
.
page
(
batch_page
).
per
(
batch_size
)
end
relation
.
offset
(
batch_page
).
limit
(
batch_size
)
else
relation
.
page
(
batch_page
).
per
(
batch_size
)
end
paginated_collection
=
paginated_collection
.
by_paths
(
paths
)
if
paths
paginated_collection
end
# rubocop: enable CodeReuse/ActiveRecord
def
batch_gradual_load?
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'
RSpec
.
describe
Projects
::
MergeRequests
::
DiffsController
do
include
ProjectForksHelper
before
do
stub_feature_flags
(
diffs_gradual_load:
false
)
end
shared_examples
'404 for unexistent diffable'
do
context
'when diffable does not exists'
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
let!
(
:params
)
{
{}
}
before
do
stub_feature_flags
(
diffs_gradual_load:
false
)
project
.
add_maintainer
(
user
)
sign_in
(
user
)
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', () => {
.
onGet
(
mergeUrlParams
(
{
per_page
:
DIFFS_PER_PAGE
,
w
:
'
1
'
,
view
:
'
inline
'
,
page
:
1
,
per_page
:
DIFFS_PER_PAGE
,
},
endpointBatch
,
),
...
...
@@ -171,10 +171,10 @@ describe('DiffsStoreActions', () => {
.
onGet
(
mergeUrlParams
(
{
per_page
:
DIFFS_PER_PAGE
,
w
:
'
1
'
,
view
:
'
inline
'
,
page
:
2
,
per_page
:
DIFFS_PER_PAGE
,
},
endpointBatch
,
),
...
...
spec/models/merge_request_diff_spec.rb
View file @
3996bd75
...
...
@@ -9,6 +9,10 @@ RSpec.describe MergeRequestDiff do
let
(
:diff_with_commits
)
{
create
(
:merge_request
).
merge_request_diff
}
before
do
stub_feature_flags
(
diffs_gradual_load:
false
)
end
describe
'validations'
do
subject
{
diff_with_commits
}
...
...
spec/serializers/paginated_diff_entity_spec.rb
View file @
3996bd75
...
...
@@ -19,6 +19,10 @@ RSpec.describe PaginatedDiffEntity do
subject
{
entity
.
as_json
}
before
do
stub_feature_flags
(
diffs_gradual_load:
false
)
end
it
'exposes diff_files'
do
expect
(
subject
[
:diff_files
]).
to
be_present
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