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
c64420c2
Commit
c64420c2
authored
May 16, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
71421729
9afe8d3b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
6 deletions
+50
-6
app/assets/javascripts/diffs/components/app.vue
app/assets/javascripts/diffs/components/app.vue
+10
-2
app/assets/javascripts/diffs/store/actions.js
app/assets/javascripts/diffs/store/actions.js
+6
-3
changelogs/unreleased/diff-whitespace-setting-changes.yml
changelogs/unreleased/diff-whitespace-setting-changes.yml
+5
-0
spec/javascripts/diffs/store/actions_spec.js
spec/javascripts/diffs/store/actions_spec.js
+29
-1
No files found.
app/assets/javascripts/diffs/components/app.vue
View file @
c64420c2
...
...
@@ -157,10 +157,12 @@ export default {
this
.
adjustView
();
eventHub
.
$once
(
'
fetchedNotesData
'
,
this
.
setDiscussions
);
eventHub
.
$once
(
'
fetchDiffData
'
,
this
.
fetchData
);
eventHub
.
$on
(
'
refetchDiffData
'
,
this
.
refetchDiffData
);
this
.
CENTERED_LIMITED_CONTAINER_CLASSES
=
CENTERED_LIMITED_CONTAINER_CLASSES
;
},
beforeDestroy
()
{
eventHub
.
$off
(
'
fetchDiffData
'
,
this
.
fetchData
);
eventHub
.
$off
(
'
refetchDiffData
'
,
this
.
refetchDiffData
);
this
.
removeEventListeners
();
},
methods
:
{
...
...
@@ -175,10 +177,16 @@ export default {
'
scrollToFile
'
,
'
toggleShowTreeList
'
,
]),
fetchData
()
{
refetchDiffData
()
{
this
.
assignedDiscussions
=
false
;
this
.
fetchData
(
false
);
},
fetchData
(
toggleTree
=
true
)
{
this
.
fetchDiffFiles
()
.
then
(()
=>
{
this
.
hideTreeListIfJustOneFile
();
if
(
toggleTree
)
{
this
.
hideTreeListIfJustOneFile
();
}
requestIdleCallback
(
()
=>
{
...
...
app/assets/javascripts/diffs/store/actions.js
View file @
c64420c2
...
...
@@ -52,7 +52,7 @@ export const fetchDiffFiles = ({ state, commit }) => {
});
return
axios
.
get
(
state
.
endpoint
,
{
params
:
{
w
:
state
.
showWhitespace
?
null
:
'
1
'
}
}
)
.
get
(
mergeUrlParams
({
w
:
state
.
showWhitespace
?
'
0
'
:
'
1
'
},
state
.
endpoint
)
)
.
then
(
res
=>
{
commit
(
types
.
SET_LOADING
,
false
);
commit
(
types
.
SET_MERGE_REQUEST_DIFFS
,
res
.
data
.
merge_request_diffs
||
[]);
...
...
@@ -125,7 +125,8 @@ export const startRenderDiffsQueue = ({ state, commit }) => {
new
Promise
(
resolve
=>
{
const
nextFile
=
state
.
diffFiles
.
find
(
file
=>
!
file
.
renderIt
&&
(
!
file
.
viewer
.
collapsed
||
!
file
.
viewer
.
name
===
diffViewerModes
.
text
),
!
file
.
renderIt
&&
(
file
.
viewer
&&
(
!
file
.
viewer
.
collapsed
||
!
file
.
viewer
.
name
===
diffViewerModes
.
text
)),
);
if
(
nextFile
)
{
...
...
@@ -315,8 +316,10 @@ export const setShowWhitespace = ({ commit }, { showWhitespace, pushState = fals
localStorage
.
setItem
(
WHITESPACE_STORAGE_KEY
,
showWhitespace
);
if
(
pushState
)
{
historyPushState
(
showWhitespace
?
'
?w=0
'
:
'
?w=1
'
);
historyPushState
(
mergeUrlParams
({
w
:
showWhitespace
?
'
0
'
:
'
1
'
},
window
.
location
.
href
)
);
}
eventHub
.
$emit
(
'
refetchDiffData
'
);
};
export
const
toggleFileFinder
=
({
commit
},
visible
)
=>
{
...
...
changelogs/unreleased/diff-whitespace-setting-changes.yml
0 → 100644
View file @
c64420c2
---
title
:
Fixed show whitespace button not refetching diff content
merge_request
:
author
:
type
:
fixed
spec/javascripts/diffs/store/actions_spec.js
View file @
c64420c2
...
...
@@ -82,7 +82,7 @@ describe('DiffsStoreActions', () => {
describe
(
'
fetchDiffFiles
'
,
()
=>
{
it
(
'
should fetch diff files
'
,
done
=>
{
const
endpoint
=
'
/fetch/diff/files
'
;
const
endpoint
=
'
/fetch/diff/files
?w=1
'
;
const
mock
=
new
MockAdapter
(
axios
);
const
res
=
{
diff_files
:
1
,
merge_request_diffs
:
[]
};
mock
.
onGet
(
endpoint
).
reply
(
200
,
res
);
...
...
@@ -828,6 +828,10 @@ describe('DiffsStoreActions', () => {
});
describe
(
'
setShowWhitespace
'
,
()
=>
{
beforeEach
(()
=>
{
spyOn
(
eventHub
,
'
$emit
'
).
and
.
stub
();
});
it
(
'
commits SET_SHOW_WHITESPACE
'
,
done
=>
{
testAction
(
setShowWhitespace
,
...
...
@@ -855,6 +859,30 @@ describe('DiffsStoreActions', () => {
expect
(
window
.
history
.
pushState
).
toHaveBeenCalled
();
});
it
(
'
calls history pushState with merged params
'
,
()
=>
{
const
originalPushState
=
window
.
history
;
originalPushState
.
pushState
({},
''
,
'
?test=1
'
);
spyOn
(
localStorage
,
'
setItem
'
).
and
.
stub
();
spyOn
(
window
.
history
,
'
pushState
'
).
and
.
stub
();
setShowWhitespace
({
commit
()
{}
},
{
showWhitespace
:
true
,
pushState
:
true
});
expect
(
window
.
history
.
pushState
.
calls
.
mostRecent
().
args
[
2
]).
toMatch
(
/
(
.*
)\?
test=1&w=0/
);
originalPushState
.
pushState
({},
''
,
'
?
'
);
});
it
(
'
emits eventHub event
'
,
()
=>
{
spyOn
(
localStorage
,
'
setItem
'
).
and
.
stub
();
spyOn
(
window
.
history
,
'
pushState
'
).
and
.
stub
();
setShowWhitespace
({
commit
()
{}
},
{
showWhitespace
:
true
,
pushState
:
true
});
expect
(
eventHub
.
$emit
).
toHaveBeenCalledWith
(
'
refetchDiffData
'
);
});
});
describe
(
'
setRenderIt
'
,
()
=>
{
...
...
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