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
af688bd6
Commit
af688bd6
authored
Sep 07, 2018
by
Tim Zallmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cosmetic changes to let setup
parent
d2cbe073
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
57 deletions
+48
-57
app/assets/javascripts/diffs/store/mutations.js
app/assets/javascripts/diffs/store/mutations.js
+44
-51
app/assets/javascripts/diffs/store/utils.js
app/assets/javascripts/diffs/store/utils.js
+3
-6
app/assets/javascripts/notes/stores/actions.js
app/assets/javascripts/notes/stores/actions.js
+1
-0
No files found.
app/assets/javascripts/diffs/store/mutations.js
View file @
af688bd6
...
@@ -86,68 +86,61 @@ export default {
...
@@ -86,68 +86,61 @@ export default {
[
types
.
SET_LINE_DISCUSSIONS_FOR_FILE
](
state
,
{
fileHash
,
discussions
})
{
[
types
.
SET_LINE_DISCUSSIONS_FOR_FILE
](
state
,
{
fileHash
,
discussions
})
{
const
selectedFile
=
state
.
diffFiles
.
find
(
f
=>
f
.
fileHash
===
fileHash
);
const
selectedFile
=
state
.
diffFiles
.
find
(
f
=>
f
.
fileHash
===
fileHash
);
if
(
selectedFile
)
{
const
firstDiscussion
=
discussions
[
0
];
const
targetLine
=
selectedFile
.
parallelDiffLines
.
find
(
const
targetLine
=
selectedFile
.
parallelDiffLines
.
find
(
line
=>
line
=>
(
line
.
left
&&
line
.
left
.
lineCode
===
discussions
[
0
].
line_code
)
||
(
line
.
left
&&
line
.
left
.
lineCode
===
firstDiscussion
.
line_code
)
||
(
line
.
right
&&
line
.
right
.
lineCode
===
discussions
[
0
].
line_code
),
(
line
.
right
&&
line
.
right
.
lineCode
===
firstDiscussion
.
line_code
),
);
);
if
(
targetLine
)
{
if
(
targetLine
)
{
if
(
targetLine
.
left
&&
targetLine
.
left
.
lineCode
===
discussions
[
0
].
line_code
)
{
if
(
targetLine
.
left
&&
targetLine
.
left
.
lineCode
===
firstDiscussion
.
line_code
)
{
Object
.
assign
(
targetLine
.
left
,
{
Object
.
assign
(
targetLine
.
left
,
{
discussions
,
discussions
,
});
});
}
else
{
}
else
{
Object
.
assign
(
targetLine
.
right
,
{
Object
.
assign
(
targetLine
.
right
,
{
discussions
,
discussions
,
});
});
}
}
}
}
if
(
selectedFile
.
highlightedDiffLines
)
{
if
(
selectedFile
.
highlightedDiffLines
)
{
const
targetInlineLine
=
selectedFile
.
highlightedDiffLines
.
find
(
const
targetInlineLine
=
selectedFile
.
highlightedDiffLines
.
find
(
line
=>
line
.
lineCode
===
discussions
[
0
]
.
line_code
,
line
=>
line
.
lineCode
===
firstDiscussion
.
line_code
,
);
);
if
(
targetInlineLine
)
{
if
(
targetInlineLine
)
{
Object
.
assign
(
targetInlineLine
,
{
Object
.
assign
(
targetInlineLine
,
{
discussions
,
discussions
,
});
});
}
}
}
}
}
},
},
[
types
.
REMOVE_LINE_DISCUSSIONS_FOR_FILE
](
state
,
{
fileHash
,
lineCode
})
{
[
types
.
REMOVE_LINE_DISCUSSIONS_FOR_FILE
](
state
,
{
fileHash
,
lineCode
})
{
const
selectedFile
=
state
.
diffFiles
.
find
(
f
=>
f
.
fileHash
===
fileHash
);
const
selectedFile
=
state
.
diffFiles
.
find
(
f
=>
f
.
fileHash
===
fileHash
);
if
(
selectedFile
)
{
const
targetLine
=
selectedFile
.
parallelDiffLines
.
find
(
const
targetLine
=
selectedFile
.
parallelDiffLines
.
find
(
line
=>
line
=>
(
line
.
left
&&
line
.
left
.
lineCode
===
lineCode
)
||
(
line
.
left
&&
line
.
left
.
lineCode
===
lineCode
)
||
(
line
.
right
&&
line
.
right
.
lineCode
===
lineCode
),
(
line
.
right
&&
line
.
right
.
lineCode
===
lineCode
),
);
);
if
(
targetLine
)
{
if
(
targetLine
)
{
const
side
=
targetLine
.
left
&&
targetLine
.
left
.
lineCode
===
lineCode
?
'
left
'
:
'
right
'
;
if
(
targetLine
.
left
&&
targetLine
.
left
.
lineCode
===
lineCode
)
{
Object
.
assign
(
targetLine
.
left
,
{
Object
.
assign
(
targetline
[
side
],
{
discussions
:
[],
discussions
:
[],
});
});
}
else
{
}
Object
.
assign
(
targetLine
.
right
,
{
discussions
:
[],
});
}
}
if
(
selectedFile
.
highlightedDiffLines
)
{
if
(
selectedFile
.
highlightedDiffLines
)
{
const
targetInlineLine
=
selectedFile
.
highlightedDiffLines
.
find
(
const
targetInlineLine
=
selectedFile
.
highlightedDiffLines
.
find
(
line
=>
line
.
lineCode
===
lineCode
,
line
=>
line
.
lineCode
===
lineCode
,
);
);
if
(
targetInlineLine
)
{
if
(
targetInlineLine
)
{
Object
.
assign
(
targetInlineLine
,
{
Object
.
assign
(
targetInlineLine
,
{
discussions
:
[],
discussions
:
[],
});
});
}
}
}
}
}
},
},
...
...
app/assets/javascripts/diffs/store/utils.js
View file @
af688bd6
...
@@ -186,14 +186,12 @@ export function trimFirstCharOfLineContent(line = {}) {
...
@@ -186,14 +186,12 @@ export function trimFirstCharOfLineContent(line = {}) {
export
function
prepareDiffData
(
diffData
)
{
export
function
prepareDiffData
(
diffData
)
{
const
filesLength
=
diffData
.
diffFiles
.
length
;
const
filesLength
=
diffData
.
diffFiles
.
length
;
let
showingLines
=
0
;
let
showingLines
=
0
;
let
i
;
for
(
let
i
=
0
;
i
<
filesLength
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
filesLength
;
i
+=
1
)
{
const
file
=
diffData
.
diffFiles
[
i
];
const
file
=
diffData
.
diffFiles
[
i
];
if
(
file
.
parallelDiffLines
)
{
if
(
file
.
parallelDiffLines
)
{
const
linesLength
=
file
.
parallelDiffLines
.
length
;
const
linesLength
=
file
.
parallelDiffLines
.
length
;
let
u
=
0
;
for
(
let
u
=
0
;
u
<
linesLength
;
u
+=
1
)
{
for
(
u
=
0
;
u
<
linesLength
;
u
+=
1
)
{
const
line
=
file
.
parallelDiffLines
[
u
];
const
line
=
file
.
parallelDiffLines
[
u
];
if
(
line
.
left
)
{
if
(
line
.
left
)
{
line
.
left
=
trimFirstCharOfLineContent
(
line
.
left
);
line
.
left
=
trimFirstCharOfLineContent
(
line
.
left
);
...
@@ -206,8 +204,7 @@ export function prepareDiffData(diffData) {
...
@@ -206,8 +204,7 @@ export function prepareDiffData(diffData) {
if
(
file
.
highlightedDiffLines
)
{
if
(
file
.
highlightedDiffLines
)
{
const
linesLength
=
file
.
highlightedDiffLines
.
length
;
const
linesLength
=
file
.
highlightedDiffLines
.
length
;
let
u
;
for
(
let
u
=
0
;
u
<
linesLength
;
u
+=
1
)
{
for
(
u
=
0
;
u
<
linesLength
;
u
+=
1
)
{
trimFirstCharOfLineContent
(
file
.
highlightedDiffLines
[
u
]);
trimFirstCharOfLineContent
(
file
.
highlightedDiffLines
[
u
]);
}
}
showingLines
+=
file
.
parallelDiffLines
.
length
;
showingLines
+=
file
.
parallelDiffLines
.
length
;
...
...
app/assets/javascripts/notes/stores/actions.js
View file @
af688bd6
...
@@ -54,6 +54,7 @@ export const refetchDiscussionById = ({ commit, state }, { path, discussionId })
...
@@ -54,6 +54,7 @@ export const refetchDiscussionById = ({ commit, state }, { path, discussionId })
commit
(
types
.
UPDATE_DISCUSSION
,
selectedDiscussion
);
commit
(
types
.
UPDATE_DISCUSSION
,
selectedDiscussion
);
// We need to refetch as it is now the transformed one in state
// We need to refetch as it is now the transformed one in state
const
discussion
=
utils
.
findNoteObjectById
(
state
.
discussions
,
discussionId
);
const
discussion
=
utils
.
findNoteObjectById
(
state
.
discussions
,
discussionId
);
resolve
(
discussion
);
resolve
(
discussion
);
}
}
})
})
...
...
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