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
1dbcec96
Commit
1dbcec96
authored
Jul 07, 2020
by
jboyson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Respect cookie settings
parent
3ba8ae4e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
5 deletions
+8
-5
app/assets/javascripts/diffs/index.js
app/assets/javascripts/diffs/index.js
+7
-4
spec/features/merge_request/user_toggles_whitespace_changes_spec.rb
...res/merge_request/user_toggles_whitespace_changes_spec.rb
+1
-1
No files found.
app/assets/javascripts/diffs/index.js
View file @
1dbcec96
...
...
@@ -4,7 +4,8 @@ import { parseBoolean } from '~/lib/utils/common_utils';
import
FindFile
from
'
~/vue_shared/components/file_finder/index.vue
'
;
import
eventHub
from
'
../notes/event_hub
'
;
import
diffsApp
from
'
./components/app.vue
'
;
import
{
TREE_LIST_STORAGE_KEY
}
from
'
./constants
'
;
import
{
TREE_LIST_STORAGE_KEY
,
DIFF_WHITESPACE_COOKIE_NAME
}
from
'
./constants
'
;
import
Cookies
from
'
js-cookie
'
;
export
default
function
initDiffsApp
(
store
)
{
const
fileFinderEl
=
document
.
getElementById
(
'
js-diff-file-finder
'
);
...
...
@@ -90,9 +91,11 @@ export default function initDiffsApp(store) {
this
.
setRenderTreeList
(
renderTreeList
);
// Set whitespace default as per user preferences
const
hideWhitespace
=
this
.
showWhitespaceDefault
?
'
0
'
:
'
1
'
;
this
.
setShowWhitespace
({
showWhitespace
:
hideWhitespace
!==
'
1
'
});
// Set whitespace default as per user preferences unless cookie is already set
if
(
!
Cookies
.
get
(
DIFF_WHITESPACE_COOKIE_NAME
))
{
const
hideWhitespace
=
this
.
showWhitespaceDefault
?
'
0
'
:
'
1
'
;
this
.
setShowWhitespace
({
showWhitespace
:
hideWhitespace
!==
'
1
'
});
}
},
methods
:
{
...
mapActions
(
'
diffs
'
,
[
'
setRenderTreeList
'
,
'
setShowWhitespace
'
]),
...
...
spec/features/merge_request/user_toggles_whitespace_changes_spec.rb
View file @
1dbcec96
...
...
@@ -27,7 +27,7 @@ RSpec.describe 'Merge request > User toggles whitespace changes', :js do
find
(
'.js-show-diff-settings'
).
click
expect
(
find
(
'#show-whitespace'
)).
to
be_checked
expect
(
find
(
'#show-whitespace'
)).
not_
to
be_checked
end
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