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
Léo-Paul Géneau
gitlab-ce
Commits
90673dbc
Commit
90673dbc
authored
Sep 18, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed isDiscussionApplicableToLine to accept an object
parent
c48f0c1a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
16 deletions
+28
-16
app/assets/javascripts/diffs/store/mutations.js
app/assets/javascripts/diffs/store/mutations.js
+5
-1
app/assets/javascripts/diffs/store/utils.js
app/assets/javascripts/diffs/store/utils.js
+1
-1
spec/javascripts/diffs/store/utils_spec.js
spec/javascripts/diffs/store/utils_spec.js
+22
-14
No files found.
app/assets/javascripts/diffs/store/mutations.js
View file @
90673dbc
...
@@ -97,7 +97,11 @@ export default {
...
@@ -97,7 +97,11 @@ export default {
isDiffDiscussion
&&
isDiffDiscussion
&&
hasLineCode
&&
hasLineCode
&&
diffPosition
&&
diffPosition
&&
isDiscussionApplicableToLine
(
firstDiscussion
,
diffPosition
,
state
.
latestDiff
)
isDiscussionApplicableToLine
({
discussion
:
firstDiscussion
,
diffPosition
,
latestDiff
:
state
.
latestDiff
,
})
)
{
)
{
const
targetLine
=
selectedFile
.
parallelDiffLines
.
find
(
const
targetLine
=
selectedFile
.
parallelDiffLines
.
find
(
line
=>
line
=>
...
...
app/assets/javascripts/diffs/store/utils.js
View file @
90673dbc
...
@@ -254,7 +254,7 @@ export function getDiffPositionByLineCode(diffFiles) {
...
@@ -254,7 +254,7 @@ export function getDiffPositionByLineCode(diffFiles) {
// This method will check whether the discussion is still applicable
// This method will check whether the discussion is still applicable
// to the diff line in question regarding different versions of the MR
// to the diff line in question regarding different versions of the MR
export
function
isDiscussionApplicableToLine
(
discussion
,
diffPosition
,
latestDiff
)
{
export
function
isDiscussionApplicableToLine
(
{
discussion
,
diffPosition
,
latestDiff
}
)
{
const
{
lineCode
,
...
diffPositionCopy
}
=
diffPosition
;
const
{
lineCode
,
...
diffPositionCopy
}
=
diffPosition
;
if
(
discussion
.
original_position
&&
discussion
.
position
)
{
if
(
discussion
.
original_position
&&
discussion
.
position
)
{
...
...
spec/javascripts/diffs/store/utils_spec.js
View file @
90673dbc
...
@@ -350,13 +350,21 @@ describe('DiffsStoreUtils', () => {
...
@@ -350,13 +350,21 @@ describe('DiffsStoreUtils', () => {
it
(
'
returns true when the discussion is up to date
'
,
()
=>
{
it
(
'
returns true when the discussion is up to date
'
,
()
=>
{
expect
(
expect
(
utils
.
isDiscussionApplicableToLine
(
discussions
.
upToDateDiscussion1
,
diffPosition
,
true
),
utils
.
isDiscussionApplicableToLine
({
discussion
:
discussions
.
upToDateDiscussion1
,
diffPosition
,
latestDiff
:
true
,
}),
).
toBe
(
true
);
).
toBe
(
true
);
});
});
it
(
'
returns false when the discussion is not up to date
'
,
()
=>
{
it
(
'
returns false when the discussion is not up to date
'
,
()
=>
{
expect
(
expect
(
utils
.
isDiscussionApplicableToLine
(
discussions
.
outDatedDiscussion1
,
diffPosition
,
true
),
utils
.
isDiscussionApplicableToLine
({
discussion
:
discussions
.
outDatedDiscussion1
,
diffPosition
,
latestDiff
:
true
,
}),
).
toBe
(
false
);
).
toBe
(
false
);
});
});
...
@@ -366,14 +374,14 @@ describe('DiffsStoreUtils', () => {
...
@@ -366,14 +374,14 @@ describe('DiffsStoreUtils', () => {
delete
discussion
.
position
;
delete
discussion
.
position
;
expect
(
expect
(
utils
.
isDiscussionApplicableToLine
(
utils
.
isDiscussionApplicableToLine
(
{
discussion
,
discussion
,
{
diffPosition
:
{
...
diffPosition
,
...
diffPosition
,
lineCode
:
'
ABC_1
'
,
lineCode
:
'
ABC_1
'
,
},
},
true
,
latestDiff
:
true
,
),
}
),
).
toBe
(
false
);
).
toBe
(
false
);
});
});
...
@@ -383,14 +391,14 @@ describe('DiffsStoreUtils', () => {
...
@@ -383,14 +391,14 @@ describe('DiffsStoreUtils', () => {
delete
discussion
.
position
;
delete
discussion
.
position
;
expect
(
expect
(
utils
.
isDiscussionApplicableToLine
(
utils
.
isDiscussionApplicableToLine
(
{
discussion
,
discussion
,
{
diffPosition
:
{
...
diffPosition
,
...
diffPosition
,
lineCode
:
'
ABC_1
'
,
lineCode
:
'
ABC_1
'
,
},
},
true
,
latestDiff
:
true
,
),
}
),
).
toBe
(
true
);
).
toBe
(
true
);
});
});
...
@@ -400,14 +408,14 @@ describe('DiffsStoreUtils', () => {
...
@@ -400,14 +408,14 @@ describe('DiffsStoreUtils', () => {
delete
discussion
.
position
;
delete
discussion
.
position
;
expect
(
expect
(
utils
.
isDiscussionApplicableToLine
(
utils
.
isDiscussionApplicableToLine
(
{
discussion
,
discussion
,
{
diffPosition
:
{
...
diffPosition
,
...
diffPosition
,
lineCode
:
'
ABC_1
'
,
lineCode
:
'
ABC_1
'
,
},
},
false
,
latestDiff
:
false
,
),
}
),
).
toBe
(
false
);
).
toBe
(
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