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
ece24655
Commit
ece24655
authored
Jul 17, 2020
by
Phil Hughes
Committed by
Gary Holtz
Sep 10, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Default diff version to HEAD
parent
8ba09fa1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
9 deletions
+19
-9
app/assets/javascripts/diffs/store/getters_versions_dropdowns.js
...ets/javascripts/diffs/store/getters_versions_dropdowns.js
+8
-2
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+5
-0
app/serializers/merge_request_diff_entity.rb
app/serializers/merge_request_diff_entity.rb
+1
-5
app/views/projects/merge_requests/show.html.haml
app/views/projects/merge_requests/show.html.haml
+5
-2
No files found.
app/assets/javascripts/diffs/store/getters_versions_dropdowns.js
View file @
ece24655
...
...
@@ -11,7 +11,9 @@ export const diffCompareDropdownTargetVersions = (state, getters) => {
// startVersion only exists if the user has selected a version other
// than "base" so if startVersion is null then base must be selected
const
diffHead
=
parseBoolean
(
getParameterByName
(
'
diff_head
'
));
const
defaultMergeRefForDiffs
=
window
.
gon
?.
features
?.
defaultMergeRefForDiffs
;
const
diffHeadParam
=
getParameterByName
(
'
diff_head
'
);
const
diffHead
=
parseBoolean
(
diffHeadParam
)
||
(
!
diffHeadParam
&&
defaultMergeRefForDiffs
);
const
isBaseSelected
=
!
state
.
startVersion
&&
!
diffHead
;
const
isHeadSelected
=
!
state
.
startVersion
&&
diffHead
;
...
...
@@ -40,7 +42,11 @@ export const diffCompareDropdownTargetVersions = (state, getters) => {
};
};
return
[...
state
.
mergeRequestDiffs
.
slice
(
1
).
map
(
formatVersion
),
baseVersion
,
headVersion
];
return
[
...
state
.
mergeRequestDiffs
.
slice
(
1
).
map
(
formatVersion
),
defaultMergeRefForDiffs
&&
baseVersion
,
headVersion
,
].
filter
(
a
=>
a
);
};
export
const
diffCompareDropdownSourceVersions
=
(
state
,
getters
)
=>
{
...
...
app/controllers/projects/merge_requests_controller.rb
View file @
ece24655
...
...
@@ -41,6 +41,7 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
push_frontend_feature_flag
(
:merge_request_widget_graphql
,
@project
)
push_frontend_feature_flag
(
:unified_diff_lines
,
@project
)
push_frontend_feature_flag
(
:highlight_current_diff_row
,
@project
)
push_frontend_feature_flag
(
:default_merge_ref_for_diffs
,
@project
)
end
before_action
do
...
...
@@ -451,6 +452,10 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
params
=
request
.
query_parameters
params
[
:view
]
=
cookies
[
:diff_view
]
if
params
[
:view
].
blank?
&&
cookies
[
:diff_view
].
present?
if
Feature
.
enabled?
(
:default_merge_ref_for_diffs
,
@project
)
params
=
params
.
merge
(
diff_head:
true
)
end
diffs_metadata_project_json_merge_request_path
(
project
,
merge_request
,
'json'
,
params
)
end
end
...
...
app/serializers/merge_request_diff_entity.rb
View file @
ece24655
...
...
@@ -31,11 +31,7 @@ class MergeRequestDiffEntity < Grape::Entity
next
unless
project
if
Feature
.
enabled?
(
:default_merge_ref_for_diffs
)
diffs_project_merge_request_path
(
project
,
merge_request
,
diff_head:
true
)
else
merge_request_version_path
(
project
,
merge_request
,
merge_request_diff
)
end
merge_request_version_path
(
project
,
merge_request
,
merge_request_diff
)
end
expose
:head_version_path
do
|
merge_request_diff
|
...
...
app/views/projects/merge_requests/show.html.haml
View file @
ece24655
...
...
@@ -70,10 +70,13 @@
=
render
'projects/commit/pipelines_list'
,
disable_initialization:
true
,
endpoint:
pipelines_project_merge_request_path
(
@project
,
@merge_request
)
-
if
mr_action
===
"diffs"
-
add_page_startup_api_call
@endpoint_metadata_url
-
params
=
request
.
query_parameters
-
if
Feature
.
enabled?
(
:default_merge_ref_for_diffs
,
@project
)
-
params
=
params
.
merge
(
diff_head:
true
)
=
render
"projects/merge_requests/tabs/pane"
,
name:
"diffs"
,
id:
"js-diffs-app"
,
class:
"diffs"
,
data:
{
"is-locked"
:
@merge_request
.
discussion_locked?
,
endpoint:
diffs_project_merge_request_path
(
@project
,
@merge_request
,
'json'
,
request
.
query_parameters
)
,
endpoint:
diffs_project_merge_request_path
(
@project
,
@merge_request
,
'json'
,
params
,
endpoint_metadata:
@endpoint_metadata_url
,
endpoint_batch:
diffs_batch_project_json_merge_request_path
(
@project
,
@merge_request
,
'json'
,
request
.
query_parameters
)
,
endpoint_batch:
diffs_batch_project_json_merge_request_path
(
@project
,
@merge_request
,
'json'
,
params
,
endpoint_coverage:
@coverage_path
,
help_page_path:
suggest_changes_help_path
,
current_user_data:
@current_user_data
,
...
...
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