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
f32ec46e
Commit
f32ec46e
authored
Sep 08, 2018
by
Tim Zallmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for a check that fails if no file can be selected
parent
1be03eaa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
42 deletions
+46
-42
app/assets/javascripts/diffs/store/mutations.js
app/assets/javascripts/diffs/store/mutations.js
+46
-42
No files found.
app/assets/javascripts/diffs/store/mutations.js
View file @
f32ec46e
...
...
@@ -86,62 +86,66 @@ export default {
[
types
.
SET_LINE_DISCUSSIONS_FOR_FILE
](
state
,
{
fileHash
,
discussions
})
{
const
selectedFile
=
state
.
diffFiles
.
find
(
f
=>
f
.
fileHash
===
fileHash
);
const
firstDiscussion
=
discussions
[
0
];
const
targetLine
=
selectedFile
.
parallelDiffLines
.
find
(
line
=>
(
line
.
left
&&
line
.
left
.
lineCode
===
firstDiscussion
.
line_code
)
||
(
line
.
right
&&
line
.
right
.
lineCode
===
firstDiscussion
.
line_code
),
);
if
(
targetLine
)
{
if
(
targetLine
.
left
&&
targetLine
.
left
.
lineCode
===
firstDiscussion
.
line_code
)
{
Object
.
assign
(
targetLine
.
left
,
{
discussions
,
});
}
else
{
Object
.
assign
(
targetLine
.
right
,
{
discussions
,
});
if
(
selectedFile
)
{
const
firstDiscussion
=
discussions
[
0
];
const
targetLine
=
selectedFile
.
parallelDiffLines
.
find
(
line
=>
(
line
.
left
&&
line
.
left
.
lineCode
===
firstDiscussion
.
line_code
)
||
(
line
.
right
&&
line
.
right
.
lineCode
===
firstDiscussion
.
line_code
),
);
if
(
targetLine
)
{
if
(
targetLine
.
left
&&
targetLine
.
left
.
lineCode
===
firstDiscussion
.
line_code
)
{
Object
.
assign
(
targetLine
.
left
,
{
discussions
,
});
}
else
{
Object
.
assign
(
targetLine
.
right
,
{
discussions
,
});
}
}
}
if
(
selectedFile
.
highlightedDiffLines
)
{
const
targetInlineLine
=
selectedFile
.
highlightedDiffLines
.
find
(
line
=>
line
.
lineCode
===
firstDiscussion
.
line_code
,
);
if
(
selectedFile
.
highlightedDiffLines
)
{
const
targetInlineLine
=
selectedFile
.
highlightedDiffLines
.
find
(
line
=>
line
.
lineCode
===
firstDiscussion
.
line_code
,
);
if
(
targetInlineLine
)
{
Object
.
assign
(
targetInlineLine
,
{
discussions
,
});
if
(
targetInlineLine
)
{
Object
.
assign
(
targetInlineLine
,
{
discussions
,
});
}
}
}
},
[
types
.
REMOVE_LINE_DISCUSSIONS_FOR_FILE
](
state
,
{
fileHash
,
lineCode
})
{
const
selectedFile
=
state
.
diffFiles
.
find
(
f
=>
f
.
fileHash
===
fileHash
);
const
targetLine
=
selectedFile
.
parallelDiffLines
.
find
(
line
=>
(
line
.
left
&&
line
.
left
.
lineCode
===
lineCode
)
||
(
line
.
right
&&
line
.
right
.
lineCode
===
lineCode
),
);
if
(
targetLine
)
{
const
side
=
targetLine
.
left
&&
targetLine
.
left
.
lineCode
===
lineCode
?
'
left
'
:
'
right
'
;
Object
.
assign
(
targetLine
[
side
],
{
discussions
:
[],
});
}
if
(
selectedFile
.
highlightedDiffLines
)
{
const
targetInlineLine
=
selectedFile
.
highlightedDiffLines
.
find
(
line
=>
line
.
lineCode
===
lineCode
,
if
(
selectedFile
)
{
const
targetLine
=
selectedFile
.
parallelDiffLines
.
find
(
line
=>
(
line
.
left
&&
line
.
left
.
lineCode
===
lineCode
)
||
(
line
.
right
&&
line
.
right
.
lineCode
===
lineCode
),
);
if
(
targetLine
)
{
const
side
=
targetLine
.
left
&&
targetLine
.
left
.
lineCode
===
lineCode
?
'
left
'
:
'
right
'
;
if
(
targetInlineLine
)
{
Object
.
assign
(
targetInlineLine
,
{
Object
.
assign
(
targetLine
[
side
],
{
discussions
:
[],
});
}
if
(
selectedFile
.
highlightedDiffLines
)
{
const
targetInlineLine
=
selectedFile
.
highlightedDiffLines
.
find
(
line
=>
line
.
lineCode
===
lineCode
,
);
if
(
targetInlineLine
)
{
Object
.
assign
(
targetInlineLine
,
{
discussions
:
[],
});
}
}
}
},
};
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