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
Boxiang Sun
gitlab-ce
Commits
4a2b1970
Commit
4a2b1970
authored
Nov 15, 2018
by
George Tsiolis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename diffs store variable
parent
6c51a6df
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
9 deletions
+14
-9
app/assets/javascripts/diffs/store/actions.js
app/assets/javascripts/diffs/store/actions.js
+1
-1
app/assets/javascripts/diffs/store/getters.js
app/assets/javascripts/diffs/store/getters.js
+1
-1
changelogs/unreleased/gt-rename-diffs-store-variable.yml
changelogs/unreleased/gt-rename-diffs-store-variable.yml
+5
-0
spec/javascripts/diffs/store/actions_spec.js
spec/javascripts/diffs/store/actions_spec.js
+3
-3
spec/javascripts/diffs/store/getters_spec.js
spec/javascripts/diffs/store/getters_spec.js
+4
-4
No files found.
app/assets/javascripts/diffs/store/actions.js
View file @
4a2b1970
...
@@ -167,7 +167,7 @@ export const expandAllFiles = ({ commit }) => {
...
@@ -167,7 +167,7 @@ export const expandAllFiles = ({ commit }) => {
export
const
toggleFileDiscussions
=
({
getters
,
dispatch
},
diff
)
=>
{
export
const
toggleFileDiscussions
=
({
getters
,
dispatch
},
diff
)
=>
{
const
discussions
=
getters
.
getDiffFileDiscussions
(
diff
);
const
discussions
=
getters
.
getDiffFileDiscussions
(
diff
);
const
shouldCloseAll
=
getters
.
diffHasAllExpandedDiscussions
(
diff
);
const
shouldCloseAll
=
getters
.
diffHasAllExpandedDiscussions
(
diff
);
const
shouldExpandAll
=
getters
.
diffHasAllColl
pa
sedDiscussions
(
diff
);
const
shouldExpandAll
=
getters
.
diffHasAllColl
ap
sedDiscussions
(
diff
);
discussions
.
forEach
(
discussion
=>
{
discussions
.
forEach
(
discussion
=>
{
const
data
=
{
discussionId
:
discussion
.
id
};
const
data
=
{
discussionId
:
discussion
.
id
};
...
...
app/assets/javascripts/diffs/store/getters.js
View file @
4a2b1970
...
@@ -27,7 +27,7 @@ export const diffHasAllExpandedDiscussions = (state, getters) => diff => {
...
@@ -27,7 +27,7 @@ export const diffHasAllExpandedDiscussions = (state, getters) => diff => {
* @param {Object} diff
* @param {Object} diff
* @returns {Boolean}
* @returns {Boolean}
*/
*/
export
const
diffHasAllColl
pa
sedDiscussions
=
(
state
,
getters
)
=>
diff
=>
{
export
const
diffHasAllColl
ap
sedDiscussions
=
(
state
,
getters
)
=>
diff
=>
{
const
discussions
=
getters
.
getDiffFileDiscussions
(
diff
);
const
discussions
=
getters
.
getDiffFileDiscussions
(
diff
);
return
(
return
(
...
...
changelogs/unreleased/gt-rename-diffs-store-variable.yml
0 → 100644
View file @
4a2b1970
---
title
:
Rename diffs store variable
merge_request
:
23123
author
:
George Tsiolis
type
:
other
spec/javascripts/diffs/store/actions_spec.js
View file @
4a2b1970
...
@@ -416,7 +416,7 @@ describe('DiffsStoreActions', () => {
...
@@ -416,7 +416,7 @@ describe('DiffsStoreActions', () => {
const
getters
=
{
const
getters
=
{
getDiffFileDiscussions
:
jasmine
.
createSpy
().
and
.
returnValue
([{
id
:
1
}]),
getDiffFileDiscussions
:
jasmine
.
createSpy
().
and
.
returnValue
([{
id
:
1
}]),
diffHasAllExpandedDiscussions
:
jasmine
.
createSpy
().
and
.
returnValue
(
true
),
diffHasAllExpandedDiscussions
:
jasmine
.
createSpy
().
and
.
returnValue
(
true
),
diffHasAllColl
pa
sedDiscussions
:
jasmine
.
createSpy
().
and
.
returnValue
(
false
),
diffHasAllColl
ap
sedDiscussions
:
jasmine
.
createSpy
().
and
.
returnValue
(
false
),
};
};
const
dispatch
=
jasmine
.
createSpy
(
'
dispatch
'
);
const
dispatch
=
jasmine
.
createSpy
(
'
dispatch
'
);
...
@@ -434,7 +434,7 @@ describe('DiffsStoreActions', () => {
...
@@ -434,7 +434,7 @@ describe('DiffsStoreActions', () => {
const
getters
=
{
const
getters
=
{
getDiffFileDiscussions
:
jasmine
.
createSpy
().
and
.
returnValue
([{
id
:
1
}]),
getDiffFileDiscussions
:
jasmine
.
createSpy
().
and
.
returnValue
([{
id
:
1
}]),
diffHasAllExpandedDiscussions
:
jasmine
.
createSpy
().
and
.
returnValue
(
false
),
diffHasAllExpandedDiscussions
:
jasmine
.
createSpy
().
and
.
returnValue
(
false
),
diffHasAllColl
pa
sedDiscussions
:
jasmine
.
createSpy
().
and
.
returnValue
(
true
),
diffHasAllColl
ap
sedDiscussions
:
jasmine
.
createSpy
().
and
.
returnValue
(
true
),
};
};
const
dispatch
=
jasmine
.
createSpy
();
const
dispatch
=
jasmine
.
createSpy
();
...
@@ -452,7 +452,7 @@ describe('DiffsStoreActions', () => {
...
@@ -452,7 +452,7 @@ describe('DiffsStoreActions', () => {
const
getters
=
{
const
getters
=
{
getDiffFileDiscussions
:
jasmine
.
createSpy
().
and
.
returnValue
([{
expanded
:
false
,
id
:
1
}]),
getDiffFileDiscussions
:
jasmine
.
createSpy
().
and
.
returnValue
([{
expanded
:
false
,
id
:
1
}]),
diffHasAllExpandedDiscussions
:
jasmine
.
createSpy
().
and
.
returnValue
(
false
),
diffHasAllExpandedDiscussions
:
jasmine
.
createSpy
().
and
.
returnValue
(
false
),
diffHasAllColl
pa
sedDiscussions
:
jasmine
.
createSpy
().
and
.
returnValue
(
false
),
diffHasAllColl
ap
sedDiscussions
:
jasmine
.
createSpy
().
and
.
returnValue
(
false
),
};
};
const
dispatch
=
jasmine
.
createSpy
();
const
dispatch
=
jasmine
.
createSpy
();
...
...
spec/javascripts/diffs/store/getters_spec.js
View file @
4a2b1970
...
@@ -106,13 +106,13 @@ describe('Diffs Module Getters', () => {
...
@@ -106,13 +106,13 @@ describe('Diffs Module Getters', () => {
});
});
});
});
describe
(
'
diffHasAllColl
pa
sedDiscussions
'
,
()
=>
{
describe
(
'
diffHasAllColl
ap
sedDiscussions
'
,
()
=>
{
it
(
'
returns true when all discussions are collapsed
'
,
()
=>
{
it
(
'
returns true when all discussions are collapsed
'
,
()
=>
{
discussionMock
.
diff_file
.
file_hash
=
diffFileMock
.
fileHash
;
discussionMock
.
diff_file
.
file_hash
=
diffFileMock
.
fileHash
;
discussionMock
.
expanded
=
false
;
discussionMock
.
expanded
=
false
;
expect
(
expect
(
getters
.
diffHasAllColl
pa
sedDiscussions
(
localState
,
{
getters
.
diffHasAllColl
ap
sedDiscussions
(
localState
,
{
getDiffFileDiscussions
:
()
=>
[
discussionMock
],
getDiffFileDiscussions
:
()
=>
[
discussionMock
],
})(
diffFileMock
),
})(
diffFileMock
),
).
toEqual
(
true
);
).
toEqual
(
true
);
...
@@ -120,7 +120,7 @@ describe('Diffs Module Getters', () => {
...
@@ -120,7 +120,7 @@ describe('Diffs Module Getters', () => {
it
(
'
returns false when there are no discussions
'
,
()
=>
{
it
(
'
returns false when there are no discussions
'
,
()
=>
{
expect
(
expect
(
getters
.
diffHasAllColl
pa
sedDiscussions
(
localState
,
{
getters
.
diffHasAllColl
ap
sedDiscussions
(
localState
,
{
getDiffFileDiscussions
:
()
=>
[],
getDiffFileDiscussions
:
()
=>
[],
})(
diffFileMock
),
})(
diffFileMock
),
).
toEqual
(
false
);
).
toEqual
(
false
);
...
@@ -130,7 +130,7 @@ describe('Diffs Module Getters', () => {
...
@@ -130,7 +130,7 @@ describe('Diffs Module Getters', () => {
discussionMock1
.
expanded
=
false
;
discussionMock1
.
expanded
=
false
;
expect
(
expect
(
getters
.
diffHasAllColl
pa
sedDiscussions
(
localState
,
{
getters
.
diffHasAllColl
ap
sedDiscussions
(
localState
,
{
getDiffFileDiscussions
:
()
=>
[
discussionMock
,
discussionMock1
],
getDiffFileDiscussions
:
()
=>
[
discussionMock
,
discussionMock1
],
})(
diffFileMock
),
})(
diffFileMock
),
).
toEqual
(
false
);
).
toEqual
(
false
);
...
...
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