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
ef4e3b6e
Commit
ef4e3b6e
authored
Sep 13, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved legacy diff note check into util method
Un-commented out expect checks in mutation spec
parent
f9e290b9
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
11 deletions
+8
-11
app/assets/javascripts/diffs/store/mutations.js
app/assets/javascripts/diffs/store/mutations.js
+2
-2
app/assets/javascripts/notes/stores/utils.js
app/assets/javascripts/notes/stores/utils.js
+2
-5
spec/javascripts/diffs/store/mutations_spec.js
spec/javascripts/diffs/store/mutations_spec.js
+4
-4
No files found.
app/assets/javascripts/diffs/store/mutations.js
View file @
ef4e3b6e
import
Vue
from
'
vue
'
;
import
{
convertObjectPropsToCamelCase
}
from
'
~/lib/utils/common_utils
'
;
import
{
isLegacyDiffNote
}
from
'
~/notes/stores/utils
'
;
import
{
findDiffFile
,
addLineReferences
,
...
...
@@ -90,8 +91,7 @@ export default {
const
firstDiscussion
=
discussions
[
0
];
const
isDiffDiscussion
=
firstDiscussion
.
diff_discussion
;
const
hasLineCode
=
firstDiscussion
.
line_code
;
const
isResolvable
=
firstDiscussion
.
resolvable
||
(
!
firstDiscussion
.
resolvable
&&
!
firstDiscussion
.
position
);
const
isResolvable
=
firstDiscussion
.
resolvable
||
isLegacyDiffNote
(
firstDiscussion
);
const
diffPosition
=
diffPositionByLineCode
[
firstDiscussion
.
line_code
];
if
(
...
...
app/assets/javascripts/notes/stores/utils.js
View file @
ef4e3b6e
...
...
@@ -2,6 +2,7 @@ import AjaxCache from '~/lib/utils/ajax_cache';
const
REGEX_QUICK_ACTIONS
=
/^
\/\w
+.*$/gm
;
export
const
isLegacyDiffNote
=
note
=>
!
note
.
resolvable
&&
!
note
.
position
;
export
const
findNoteObjectById
=
(
notes
,
id
)
=>
notes
.
filter
(
n
=>
n
.
id
===
id
)[
0
];
export
const
getQuickActionText
=
note
=>
{
...
...
@@ -27,11 +28,7 @@ export const getQuickActionText = note => {
export
const
reduceDiscussionsToLineCodes
=
selectedDiscussions
=>
selectedDiscussions
.
reduce
((
acc
,
note
)
=>
{
if
(
note
.
diff_discussion
&&
note
.
line_code
&&
(
note
.
resolvable
||
(
!
note
.
resolvable
&&
!
note
.
position
))
)
{
if
(
note
.
diff_discussion
&&
note
.
line_code
&&
(
note
.
resolvable
||
isLegacyDiffNote
(
note
)))
{
// For context about line notes: there might be multiple notes with the same line code
const
items
=
acc
[
note
.
line_code
]
||
[];
items
.
push
(
note
);
...
...
spec/javascripts/diffs/store/mutations_spec.js
View file @
ef4e3b6e
...
...
@@ -290,11 +290,11 @@ describe('DiffsStoreMutations', () => {
diffPositionByLineCode
,
});
//
expect(state.diffFiles[0].parallelDiffLines[0].left.discussions.length).toEqual(2);
//
expect(state.diffFiles[0].parallelDiffLines[0].left.discussions[1].id).toEqual(2);
expect
(
state
.
diffFiles
[
0
].
parallelDiffLines
[
0
].
left
.
discussions
.
length
).
toEqual
(
2
);
expect
(
state
.
diffFiles
[
0
].
parallelDiffLines
[
0
].
left
.
discussions
[
1
].
id
).
toEqual
(
2
);
//
expect(state.diffFiles[0].highlightedDiffLines[0].discussions.length).toEqual(2);
//
expect(state.diffFiles[0].highlightedDiffLines[0].discussions[1].id).toEqual(2);
expect
(
state
.
diffFiles
[
0
].
highlightedDiffLines
[
0
].
discussions
.
length
).
toEqual
(
2
);
expect
(
state
.
diffFiles
[
0
].
highlightedDiffLines
[
0
].
discussions
[
1
].
id
).
toEqual
(
2
);
});
});
...
...
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