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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
7407dfdc
Commit
7407dfdc
authored
Jan 16, 2019
by
Natalia Tepluhina
Committed by
Douwe Maan
Jan 16, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve "In Merge Request diff screen, master is not a hyperlink"
parent
eec16ee2
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
92 additions
and
30 deletions
+92
-30
app/assets/javascripts/diffs/components/compare_versions.vue
app/assets/javascripts/diffs/components/compare_versions.vue
+4
-0
app/assets/javascripts/diffs/components/compare_versions_dropdown.vue
...avascripts/diffs/components/compare_versions_dropdown.vue
+8
-6
app/serializers/merge_request_diff_entity.rb
app/serializers/merge_request_diff_entity.rb
+8
-0
changelogs/unreleased/52275-fix-master-to-be-hyperlink.yml
changelogs/unreleased/52275-fix-master-to-be-hyperlink.yml
+5
-0
spec/javascripts/diffs/components/compare_versions_dropdown_spec.js
...cripts/diffs/components/compare_versions_dropdown_spec.js
+33
-0
spec/javascripts/diffs/components/compare_versions_spec.js
spec/javascripts/diffs/components/compare_versions_spec.js
+6
-0
spec/javascripts/diffs/mock_data/merge_request_diffs.js
spec/javascripts/diffs/mock_data/merge_request_diffs.js
+28
-24
No files found.
app/assets/javascripts/diffs/components/compare_versions.vue
View file @
7407dfdc
...
@@ -54,6 +54,9 @@ export default {
...
@@ -54,6 +54,9 @@ export default {
showDropdowns
()
{
showDropdowns
()
{
return
!
this
.
commit
&&
this
.
mergeRequestDiffs
.
length
;
return
!
this
.
commit
&&
this
.
mergeRequestDiffs
.
length
;
},
},
baseVersionPath
()
{
return
this
.
mergeRequestDiff
.
base_version_path
;
},
},
},
methods
:
{
methods
:
{
...
mapActions
(
'
diffs
'
,
[
...
mapActions
(
'
diffs
'
,
[
...
@@ -95,6 +98,7 @@ export default {
...
@@ -95,6 +98,7 @@ export default {
and
and
<compare-versions-dropdown
<compare-versions-dropdown
:other-versions=
"comparableDiffs"
:other-versions=
"comparableDiffs"
:base-version-path=
"baseVersionPath"
:start-version=
"startVersion"
:start-version=
"startVersion"
:target-branch=
"targetBranch"
:target-branch=
"targetBranch"
class=
"mr-version-compare-dropdown"
class=
"mr-version-compare-dropdown"
...
...
app/assets/javascripts/diffs/components/compare_versions_dropdown.vue
View file @
7407dfdc
...
@@ -34,14 +34,13 @@ export default {
...
@@ -34,14 +34,13 @@ export default {
required
:
false
,
required
:
false
,
default
:
false
,
default
:
false
,
},
},
baseVersionPath
:
{
type
:
String
,
required
:
false
,
default
:
null
,
},
},
computed
:
{
baseVersion
()
{
return
{
name
:
'
hii
'
,
versionIndex
:
-
1
,
};
},
},
computed
:
{
targetVersions
()
{
targetVersions
()
{
if
(
this
.
mergeRequestVersion
)
{
if
(
this
.
mergeRequestVersion
)
{
return
this
.
otherVersions
;
return
this
.
otherVersions
;
...
@@ -62,6 +61,9 @@ export default {
...
@@ -62,6 +61,9 @@ export default {
);
);
},
},
href
(
version
)
{
href
(
version
)
{
if
(
this
.
isBase
(
version
))
{
return
this
.
baseVersionPath
;
}
if
(
this
.
showCommitCount
)
{
if
(
this
.
showCommitCount
)
{
return
version
.
version_path
;
return
version
.
version_path
;
}
}
...
...
app/serializers/merge_request_diff_entity.rb
View file @
7407dfdc
...
@@ -24,6 +24,14 @@ class MergeRequestDiffEntity < Grape::Entity
...
@@ -24,6 +24,14 @@ class MergeRequestDiffEntity < Grape::Entity
short_sha
(
merge_request_diff
.
head_commit_sha
)
short_sha
(
merge_request_diff
.
head_commit_sha
)
end
end
expose
:base_version_path
do
|
merge_request_diff
|
project
=
merge_request
.
target_project
next
unless
project
merge_request_version_path
(
project
,
merge_request
,
merge_request_diff
)
end
expose
:version_path
do
|
merge_request_diff
|
expose
:version_path
do
|
merge_request_diff
|
start_sha
=
options
[
:start_sha
]
start_sha
=
options
[
:start_sha
]
project
=
merge_request
.
target_project
project
=
merge_request
.
target_project
...
...
changelogs/unreleased/52275-fix-master-to-be-hyperlink.yml
0 → 100644
View file @
7407dfdc
---
title
:
Resolve In Merge Request diff screen, master is not a hyperlink
merge_request
:
23874
author
:
type
:
fixed
spec/javascripts/diffs/components/compare_versions_dropdown_spec.js
View file @
7407dfdc
// TODO: https://gitlab.com/gitlab-org/gitlab-ce/issues/48034
// TODO: https://gitlab.com/gitlab-org/gitlab-ce/issues/48034
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
CompareVersionsDropdown
from
'
~/diffs/components/compare_versions_dropdown.vue
'
;
import
diffsMockData
from
'
../mock_data/merge_request_diffs
'
;
describe
(
'
CompareVersionsDropdown
'
,
()
=>
{
let
wrapper
;
const
targetBranch
=
{
branchName
:
'
tmp-wine-dev
'
,
versionIndex
:
-
1
};
const
factory
=
(
options
=
{})
=>
{
const
localVue
=
createLocalVue
();
wrapper
=
shallowMount
(
CompareVersionsDropdown
,
{
localVue
,
...
options
});
};
afterEach
(()
=>
{
wrapper
.
destroy
();
});
it
(
'
should render a correct base version link
'
,
()
=>
{
factory
({
propsData
:
{
baseVersionPath
:
'
/gnuwget/wget2/merge_requests/6/diffs?diff_id=37
'
,
otherVersions
:
diffsMockData
.
slice
(
1
),
targetBranch
,
},
});
const
links
=
wrapper
.
findAll
(
'
a
'
);
const
lastLink
=
links
.
wrappers
[
links
.
length
-
1
];
expect
(
lastLink
.
attributes
(
'
href
'
)).
toEqual
(
wrapper
.
props
(
'
baseVersionPath
'
));
});
});
spec/javascripts/diffs/components/compare_versions_spec.js
View file @
7407dfdc
...
@@ -100,6 +100,12 @@ describe('CompareVersions', () => {
...
@@ -100,6 +100,12 @@ describe('CompareVersions', () => {
});
});
});
});
describe
(
'
baseVersionPath
'
,
()
=>
{
it
(
'
should be set correctly from mergeRequestDiff
'
,
()
=>
{
expect
(
vm
.
baseVersionPath
).
toEqual
(
vm
.
mergeRequestDiff
.
base_version_path
);
});
});
describe
(
'
isWhitespaceVisible
'
,
()
=>
{
describe
(
'
isWhitespaceVisible
'
,
()
=>
{
const
originalHref
=
window
.
location
.
href
;
const
originalHref
=
window
.
location
.
href
;
...
...
spec/javascripts/diffs/mock_data/merge_request_diffs.js
View file @
7407dfdc
export
default
[
export
default
[
{
{
versionIndex
:
4
,
base_version_path
:
'
/gnuwget/wget2/merge_requests/6/diffs?diff_id=37
'
,
createdAt
:
'
2018-10-23T11:49:16.611Z
'
,
version_index
:
4
,
commitsCount
:
4
,
created_at
:
'
2018-10-23T11:49:16.611Z
'
,
commits_count
:
4
,
latest
:
true
,
latest
:
true
,
short
CommitS
ha
:
'
de7a8f7f
'
,
short
_commit_s
ha
:
'
de7a8f7f
'
,
version
P
ath
:
'
/gnuwget/wget2/merge_requests/6/diffs?diff_id=37
'
,
version
_p
ath
:
'
/gnuwget/wget2/merge_requests/6/diffs?diff_id=37
'
,
compare
P
ath
:
compare
_p
ath
:
'
/gnuwget/wget2/merge_requests/6/diffs?diff_id=37&start_sha=de7a8f7f20c3ea2e0bef3ba01cfd41c21f6b4995
'
,
'
/gnuwget/wget2/merge_requests/6/diffs?diff_id=37&start_sha=de7a8f7f20c3ea2e0bef3ba01cfd41c21f6b4995
'
,
},
},
{
{
versionIndex
:
3
,
base_version_path
:
'
/gnuwget/wget2/merge_requests/6/diffs?diff_id=36
'
,
createdAt
:
'
2018-10-23T11:46:40.617Z
'
,
version_index
:
3
,
commitsCount
:
3
,
created_at
:
'
2018-10-23T11:46:40.617Z
'
,
commits_count
:
3
,
latest
:
false
,
latest
:
false
,
short
CommitS
ha
:
'
e78fc18f
'
,
short
_commit_s
ha
:
'
e78fc18f
'
,
version
P
ath
:
'
/gnuwget/wget2/merge_requests/6/diffs?diff_id=36
'
,
version
_p
ath
:
'
/gnuwget/wget2/merge_requests/6/diffs?diff_id=36
'
,
compare
P
ath
:
compare
_p
ath
:
'
/gnuwget/wget2/merge_requests/6/diffs?diff_id=37&start_sha=e78fc18fa37acb2185c59ca94d4a964464feb50e
'
,
'
/gnuwget/wget2/merge_requests/6/diffs?diff_id=37&start_sha=e78fc18fa37acb2185c59ca94d4a964464feb50e
'
,
},
},
{
{
versionIndex
:
2
,
base_version_path
:
'
/gnuwget/wget2/merge_requests/6/diffs?diff_id=35
'
,
createdAt
:
'
2018-10-04T09:57:39.648Z
'
,
version_index
:
2
,
commitsCount
:
2
,
created_at
:
'
2018-10-04T09:57:39.648Z
'
,
commits_count
:
2
,
latest
:
false
,
latest
:
false
,
short
CommitS
ha
:
'
48da7e7e
'
,
short
_commit_s
ha
:
'
48da7e7e
'
,
version
P
ath
:
'
/gnuwget/wget2/merge_requests/6/diffs?diff_id=35
'
,
version
_p
ath
:
'
/gnuwget/wget2/merge_requests/6/diffs?diff_id=35
'
,
compare
P
ath
:
compare
_p
ath
:
'
/gnuwget/wget2/merge_requests/6/diffs?diff_id=37&start_sha=48da7e7e9a99d41c852578bd9cb541ca4d864b3e
'
,
'
/gnuwget/wget2/merge_requests/6/diffs?diff_id=37&start_sha=48da7e7e9a99d41c852578bd9cb541ca4d864b3e
'
,
},
},
{
{
versionIndex
:
1
,
base_version_path
:
'
/gnuwget/wget2/merge_requests/6/diffs?diff_id=20
'
,
createdAt
:
'
2018-09-25T20:30:39.493Z
'
,
version_index
:
1
,
commitsCount
:
1
,
created_at
:
'
2018-09-25T20:30:39.493Z
'
,
commits_count
:
1
,
latest
:
false
,
latest
:
false
,
short
CommitS
ha
:
'
47bac2ed
'
,
short
_commit_s
ha
:
'
47bac2ed
'
,
version
P
ath
:
'
/gnuwget/wget2/merge_requests/6/diffs?diff_id=20
'
,
version
_p
ath
:
'
/gnuwget/wget2/merge_requests/6/diffs?diff_id=20
'
,
compare
P
ath
:
compare
_p
ath
:
'
/gnuwget/wget2/merge_requests/6/diffs?diff_id=37&start_sha=47bac2ed972c5bee344c1cea159a22cd7f711dc0
'
,
'
/gnuwget/wget2/merge_requests/6/diffs?diff_id=37&start_sha=47bac2ed972c5bee344c1cea159a22cd7f711dc0
'
,
},
},
];
];
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