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
18766f4c
Commit
18766f4c
authored
Dec 08, 2020
by
Thomas Randolph
Committed by
Phil Hughes
Dec 08, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert vestigial "SET_DIFF_DATA" to "SET_DIFF_METADATA"
parent
27da16c9
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
23 deletions
+16
-23
app/assets/javascripts/diffs/store/actions.js
app/assets/javascripts/diffs/store/actions.js
+2
-2
app/assets/javascripts/diffs/store/mutation_types.js
app/assets/javascripts/diffs/store/mutation_types.js
+1
-1
app/assets/javascripts/diffs/store/mutations.js
app/assets/javascripts/diffs/store/mutations.js
+1
-8
spec/frontend/diffs/store/actions_spec.js
spec/frontend/diffs/store/actions_spec.js
+1
-1
spec/frontend/diffs/store/mutations_spec.js
spec/frontend/diffs/store/mutations_spec.js
+11
-11
No files found.
app/assets/javascripts/diffs/store/actions.js
View file @
18766f4c
...
...
@@ -185,11 +185,11 @@ export const fetchDiffFilesMeta = ({ commit, state }) => {
.
get
(
mergeUrlParams
(
urlParams
,
state
.
endpointMetadata
))
.
then
(({
data
})
=>
{
const
strippedData
=
{
...
data
};
delete
strippedData
.
diff_files
;
commit
(
types
.
SET_LOADING
,
false
);
commit
(
types
.
SET_MERGE_REQUEST_DIFFS
,
data
.
merge_request_diffs
||
[]);
commit
(
types
.
SET_DIFF_DATA
,
strippedData
);
commit
(
types
.
SET_DIFF_
META
DATA
,
strippedData
);
worker
.
postMessage
(
prepareDiffData
(
data
,
state
.
diffFiles
));
...
...
app/assets/javascripts/diffs/store/mutation_types.js
View file @
18766f4c
...
...
@@ -3,7 +3,7 @@ export const SET_LOADING = 'SET_LOADING';
export
const
SET_BATCH_LOADING
=
'
SET_BATCH_LOADING
'
;
export
const
SET_RETRIEVING_BATCHES
=
'
SET_RETRIEVING_BATCHES
'
;
export
const
SET_DIFF_
DATA
=
'
SET_DIFF_
DATA
'
;
export
const
SET_DIFF_
METADATA
=
'
SET_DIFF_META
DATA
'
;
export
const
SET_DIFF_DATA_BATCH
=
'
SET_DIFF_DATA_BATCH
'
;
export
const
SET_DIFF_FILES
=
'
SET_DIFF_FILES
'
;
...
...
app/assets/javascripts/diffs/store/mutations.js
View file @
18766f4c
...
...
@@ -66,17 +66,10 @@ export default {
updateDiffFilesInState
(
state
,
files
);
},
[
types
.
SET_DIFF_DATA
](
state
,
data
)
{
let
files
=
state
.
diffFiles
;
if
(
window
.
location
.
search
.
indexOf
(
'
diff_id
'
)
!==
-
1
&&
data
.
diff_files
)
{
files
=
prepareDiffData
(
data
,
files
);
}
[
types
.
SET_DIFF_METADATA
](
state
,
data
)
{
Object
.
assign
(
state
,
{
...
convertObjectPropsToCamelCase
(
data
),
});
updateDiffFilesInState
(
state
,
files
);
},
[
types
.
SET_DIFF_DATA_BATCH
](
state
,
data
)
{
...
...
spec/frontend/diffs/store/actions_spec.js
View file @
18766f4c
...
...
@@ -249,7 +249,7 @@ describe('DiffsStoreActions', () => {
{
type
:
types
.
SET_LOADING
,
payload
:
true
},
{
type
:
types
.
SET_LOADING
,
payload
:
false
},
{
type
:
types
.
SET_MERGE_REQUEST_DIFFS
,
payload
:
diffMetadata
.
merge_request_diffs
},
{
type
:
types
.
SET_DIFF_DATA
,
payload
:
noFilesData
},
{
type
:
types
.
SET_DIFF_
META
DATA
,
payload
:
noFilesData
},
],
[],
()
=>
{
...
...
spec/frontend/diffs/store/mutations_spec.js
View file @
18766f4c
...
...
@@ -67,24 +67,24 @@ describe('DiffsStoreMutations', () => {
});
});
describe
(
'
SET_DIFF_DATA
'
,
()
=>
{
it
(
'
should
not modify the existing state
'
,
()
=>
{
describe
(
'
SET_DIFF_
META
DATA
'
,
()
=>
{
it
(
'
should
overwrite state with the camelCased data that is passed in
'
,
()
=>
{
const
state
=
{
diffFiles
:
[
{
content_sha
:
diffFileMockData
.
content_sha
,
file_hash
:
diffFileMockData
.
file_hash
,
[
INLINE_DIFF_LINES_KEY
]:
[],
},
],
diffFiles
:
[],
};
const
diffMock
=
{
diff_files
:
[
diffFileMockData
],
};
const
metaMock
=
{
other_key
:
'
value
'
,
};
mutations
[
types
.
SET_DIFF_DATA
](
state
,
diffMock
);
mutations
[
types
.
SET_DIFF_METADATA
](
state
,
diffMock
);
expect
(
state
.
diffFiles
[
0
]).
toEqual
(
diffFileMockData
);
expect
(
state
.
diffFiles
[
0
][
INLINE_DIFF_LINES_KEY
]).
toEqual
([]);
mutations
[
types
.
SET_DIFF_METADATA
](
state
,
metaMock
);
expect
(
state
.
diffFiles
[
0
]).
toEqual
(
diffFileMockData
);
expect
(
state
.
otherKey
).
toEqual
(
'
value
'
);
});
});
...
...
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