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
d3a8fb6e
Commit
d3a8fb6e
authored
Dec 05, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed expanding diff commit files
Closes
https://gitlab.com/gitlab-org/gitlab-ce/issues/50662
parent
14db2a42
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
20 deletions
+54
-20
app/assets/javascripts/diffs/store/actions.js
app/assets/javascripts/diffs/store/actions.js
+12
-6
changelogs/unreleased/diff-expand-commit-file.yml
changelogs/unreleased/diff-expand-commit-file.yml
+5
-0
spec/javascripts/diffs/store/actions_spec.js
spec/javascripts/diffs/store/actions_spec.js
+37
-14
No files found.
app/assets/javascripts/diffs/store/actions.js
View file @
d3a8fb6e
...
@@ -147,8 +147,14 @@ export const scrollToLineIfNeededParallel = (_, line) => {
...
@@ -147,8 +147,14 @@ export const scrollToLineIfNeededParallel = (_, line) => {
}
}
};
};
export
const
loadCollapsedDiff
=
({
commit
},
file
)
=>
export
const
loadCollapsedDiff
=
({
commit
,
getters
},
file
)
=>
axios
.
get
(
file
.
load_collapsed_diff_url
).
then
(
res
=>
{
axios
.
get
(
file
.
load_collapsed_diff_url
,
{
params
:
{
commit_id
:
getters
.
commitId
,
},
})
.
then
(
res
=>
{
commit
(
types
.
ADD_COLLAPSED_DIFFS
,
{
commit
(
types
.
ADD_COLLAPSED_DIFFS
,
{
file
,
file
,
data
:
res
.
data
,
data
:
res
.
data
,
...
...
changelogs/unreleased/diff-expand-commit-file.yml
0 → 100644
View file @
d3a8fb6e
---
title
:
Fixed diff files expanding not loading commit content
merge_request
:
author
:
type
:
fixed
spec/javascripts/diffs/store/actions_spec.js
View file @
d3a8fb6e
...
@@ -382,24 +382,47 @@ describe('DiffsStoreActions', () => {
...
@@ -382,24 +382,47 @@ describe('DiffsStoreActions', () => {
const
file
=
{
hash
:
123
,
load_collapsed_diff_url
:
'
/load/collapsed/diff/url
'
};
const
file
=
{
hash
:
123
,
load_collapsed_diff_url
:
'
/load/collapsed/diff/url
'
};
const
data
=
{
hash
:
123
,
parallelDiffLines
:
[{
lineCode
:
1
}]
};
const
data
=
{
hash
:
123
,
parallelDiffLines
:
[{
lineCode
:
1
}]
};
const
mock
=
new
MockAdapter
(
axios
);
const
mock
=
new
MockAdapter
(
axios
);
const
commit
=
jasmine
.
createSpy
(
'
commit
'
);
mock
.
onGet
(
file
.
loadCollapsedDiffUrl
).
reply
(
200
,
data
);
mock
.
onGet
(
file
.
loadCollapsedDiffUrl
).
reply
(
200
,
data
);
testAction
(
loadCollapsedDiff
({
commit
,
getters
:
{
commitId
:
null
}
},
file
)
loadCollapsedDiff
,
.
then
(()
=>
{
file
,
expect
(
commit
).
toHaveBeenCalledWith
(
types
.
ADD_COLLAPSED_DIFFS
,
{
file
,
data
});
{},
[
{
type
:
types
.
ADD_COLLAPSED_DIFFS
,
payload
:
{
file
,
data
},
},
],
[],
()
=>
{
mock
.
restore
();
mock
.
restore
();
done
();
done
();
},
})
);
.
catch
(
done
.
fail
);
});
it
(
'
should fetch data without commit ID
'
,
()
=>
{
const
file
=
{
load_collapsed_diff_url
:
'
/load/collapsed/diff/url
'
};
const
getters
=
{
commitId
:
null
,
};
spyOn
(
axios
,
'
get
'
).
and
.
returnValue
(
Promise
.
resolve
({
data
:
{}
}));
loadCollapsedDiff
({
commit
()
{},
getters
},
file
);
expect
(
axios
.
get
).
toHaveBeenCalledWith
(
file
.
load_collapsed_diff_url
,
{
params
:
{
commit_id
:
null
},
});
});
it
(
'
should fetch data with commit ID
'
,
()
=>
{
const
file
=
{
load_collapsed_diff_url
:
'
/load/collapsed/diff/url
'
};
const
getters
=
{
commitId
:
'
123
'
,
};
spyOn
(
axios
,
'
get
'
).
and
.
returnValue
(
Promise
.
resolve
({
data
:
{}
}));
loadCollapsedDiff
({
commit
()
{},
getters
},
file
);
expect
(
axios
.
get
).
toHaveBeenCalledWith
(
file
.
load_collapsed_diff_url
,
{
params
:
{
commit_id
:
'
123
'
},
});
});
});
});
});
...
...
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