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
290f8281
Commit
290f8281
authored
Nov 15, 2018
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'upstream/master' into ce-to-ee-2018-11-15
parents
cda018c2
5a67581b
Changes
43
Hide whitespace changes
Inline
Side-by-side
Showing
43 changed files
with
708 additions
and
701 deletions
+708
-701
.gitlab-ci.yml
.gitlab-ci.yml
+6
-3
app/assets/javascripts/diffs/components/app.vue
app/assets/javascripts/diffs/components/app.vue
+1
-1
app/assets/javascripts/diffs/components/commit_item.vue
app/assets/javascripts/diffs/components/commit_item.vue
+17
-15
app/assets/javascripts/diffs/components/compare_versions_dropdown.vue
...avascripts/diffs/components/compare_versions_dropdown.vue
+12
-12
app/assets/javascripts/diffs/components/diff_content.vue
app/assets/javascripts/diffs/components/diff_content.vue
+10
-10
app/assets/javascripts/diffs/components/diff_file.vue
app/assets/javascripts/diffs/components/diff_file.vue
+13
-11
app/assets/javascripts/diffs/components/diff_file_header.vue
app/assets/javascripts/diffs/components/diff_file_header.vue
+28
-28
app/assets/javascripts/diffs/components/diff_line_gutter_content.vue
...javascripts/diffs/components/diff_line_gutter_content.vue
+7
-7
app/assets/javascripts/diffs/components/diff_line_note_form.vue
...sets/javascripts/diffs/components/diff_line_note_form.vue
+3
-3
app/assets/javascripts/diffs/components/diff_table_cell.vue
app/assets/javascripts/diffs/components/diff_table_cell.vue
+1
-3
app/assets/javascripts/diffs/components/inline_diff_comment_row.vue
.../javascripts/diffs/components/inline_diff_comment_row.vue
+1
-1
app/assets/javascripts/diffs/components/inline_diff_table_row.vue
...ts/javascripts/diffs/components/inline_diff_table_row.vue
+2
-4
app/assets/javascripts/diffs/components/inline_diff_view.vue
app/assets/javascripts/diffs/components/inline_diff_view.vue
+4
-4
app/assets/javascripts/diffs/components/parallel_diff_comment_row.vue
...avascripts/diffs/components/parallel_diff_comment_row.vue
+2
-2
app/assets/javascripts/diffs/components/parallel_diff_table_row.vue
.../javascripts/diffs/components/parallel_diff_table_row.vue
+4
-4
app/assets/javascripts/diffs/components/parallel_diff_view.vue
...ssets/javascripts/diffs/components/parallel_diff_view.vue
+3
-3
app/assets/javascripts/diffs/index.js
app/assets/javascripts/diffs/index.js
+1
-4
app/assets/javascripts/diffs/store/actions.js
app/assets/javascripts/diffs/store/actions.js
+3
-3
app/assets/javascripts/diffs/store/getters.js
app/assets/javascripts/diffs/store/getters.js
+5
-7
app/assets/javascripts/diffs/store/mutations.js
app/assets/javascripts/diffs/store/mutations.js
+28
-31
app/assets/javascripts/diffs/store/utils.js
app/assets/javascripts/diffs/store/utils.js
+64
-72
app/assets/javascripts/notes/components/diff_with_note.vue
app/assets/javascripts/notes/components/diff_with_note.vue
+18
-19
app/assets/javascripts/notes/components/noteable_discussion.vue
...sets/javascripts/notes/components/noteable_discussion.vue
+22
-22
app/assets/javascripts/notes/stores/actions.js
app/assets/javascripts/notes/stores/actions.js
+1
-1
app/assets/javascripts/notes/stores/mutations.js
app/assets/javascripts/notes/stores/mutations.js
+2
-2
app/assets/stylesheets/pages/notes.scss
app/assets/stylesheets/pages/notes.scss
+25
-2
doc/workflow/shortcuts.md
doc/workflow/shortcuts.md
+1
-1
spec/javascripts/diffs/components/commit_item_spec.js
spec/javascripts/diffs/components/commit_item_spec.js
+15
-15
spec/javascripts/diffs/components/commit_widget_spec.js
spec/javascripts/diffs/components/commit_widget_spec.js
+1
-1
spec/javascripts/diffs/components/diff_content_spec.js
spec/javascripts/diffs/components/diff_content_spec.js
+10
-10
spec/javascripts/diffs/components/diff_file_header_spec.js
spec/javascripts/diffs/components/diff_file_header_spec.js
+45
-46
spec/javascripts/diffs/components/diff_file_spec.js
spec/javascripts/diffs/components/diff_file_spec.js
+8
-8
spec/javascripts/diffs/components/diff_line_gutter_content_spec.js
...scripts/diffs/components/diff_line_gutter_content_spec.js
+13
-12
spec/javascripts/diffs/components/diff_line_note_form_spec.js
.../javascripts/diffs/components/diff_line_note_form_spec.js
+3
-3
spec/javascripts/diffs/components/inline_diff_view_spec.js
spec/javascripts/diffs/components/inline_diff_view_spec.js
+6
-3
spec/javascripts/diffs/components/parallel_diff_view_spec.js
spec/javascripts/diffs/components/parallel_diff_view_spec.js
+1
-1
spec/javascripts/diffs/mock_data/diff_file.js
spec/javascripts/diffs/mock_data/diff_file.js
+119
-119
spec/javascripts/diffs/mock_data/diff_with_commit.js
spec/javascripts/diffs/mock_data/diff_with_commit.js
+1
-3
spec/javascripts/diffs/store/actions_spec.js
spec/javascripts/diffs/store/actions_spec.js
+40
-44
spec/javascripts/diffs/store/getters_spec.js
spec/javascripts/diffs/store/getters_spec.js
+5
-5
spec/javascripts/diffs/store/mutations_spec.js
spec/javascripts/diffs/store/mutations_spec.js
+59
-63
spec/javascripts/diffs/store/utils_spec.js
spec/javascripts/diffs/store/utils_spec.js
+96
-90
spec/javascripts/notes/components/diff_with_note_spec.js
spec/javascripts/notes/components/diff_with_note_spec.js
+2
-3
No files found.
.gitlab-ci.yml
View file @
290f8281
...
...
@@ -962,7 +962,8 @@ code_quality:
--volume /var/run/docker.sock:/var/run/docker.sock
"registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code
artifacts
:
paths
:
[
gl-code-quality-report.json
]
reports
:
codequality
:
gl-code-quality-report.json
expire_in
:
1 week
sast
:
...
...
@@ -986,7 +987,8 @@ sast:
--volume /var/run/docker.sock:/var/run/docker.sock
"registry.gitlab.com/gitlab-org/security-products/sast:$SP_VERSION" /app/bin/run /code
artifacts
:
paths
:
[
gl-sast-report.json
]
reports
:
sast
:
gl-sast-report.json
dependency_scanning
:
<<
:
*dedicated-no-docs-no-db-pull-cache-job
...
...
@@ -1008,7 +1010,8 @@ dependency_scanning:
--volume /var/run/docker.sock:/var/run/docker.sock
"registry.gitlab.com/gitlab-org/security-products/dependency-scanning:$SP_VERSION" /code
artifacts
:
paths
:
[
gl-dependency-scanning-report.json
]
reports
:
dependency_scanning
:
gl-dependency-scanning-report.json
qa:internal:
<<
:
*dedicated-no-docs-no-db-pull-cache-job
...
...
app/assets/javascripts/diffs/components/app.vue
View file @
290f8281
...
...
@@ -94,7 +94,7 @@ export default {
return
__
(
'
Show latest version
'
);
},
canCurrentUserFork
()
{
return
this
.
currentUser
.
can
Fork
===
true
&&
this
.
currentUser
.
canCreateMergeR
equest
;
return
this
.
currentUser
.
can
_fork
===
true
&&
this
.
currentUser
.
can_create_merge_r
equest
;
},
showCompareVersions
()
{
return
this
.
mergeRequestDiffs
&&
this
.
mergeRequestDiff
;
...
...
app/assets/javascripts/diffs/components/commit_item.vue
View file @
290f8281
...
...
@@ -40,15 +40,17 @@ export default {
},
computed
:
{
authorName
()
{
return
(
this
.
commit
.
author
&&
this
.
commit
.
author
.
name
)
||
this
.
commit
.
author
N
ame
;
return
(
this
.
commit
.
author
&&
this
.
commit
.
author
.
name
)
||
this
.
commit
.
author
_n
ame
;
},
authorUrl
()
{
return
(
(
this
.
commit
.
author
&&
this
.
commit
.
author
.
web
Url
)
||
`mailto:
${
this
.
commit
.
authorE
mail
}
`
(
this
.
commit
.
author
&&
this
.
commit
.
author
.
web
_url
)
||
`mailto:
${
this
.
commit
.
author_e
mail
}
`
);
},
authorAvatar
()
{
return
(
this
.
commit
.
author
&&
this
.
commit
.
author
.
avatarUrl
)
||
this
.
commit
.
authorGravatarUrl
;
return
(
(
this
.
commit
.
author
&&
this
.
commit
.
author
.
avatar_url
)
||
this
.
commit
.
author_gravatar_url
);
},
},
};
...
...
@@ -66,18 +68,18 @@ export default {
<div
class=
"commit-detail flex-list"
>
<div
class=
"commit-content qa-commit-content"
>
<a
:href=
"commit.commit
U
rl"
:href=
"commit.commit
_u
rl"
class=
"commit-row-message item-title"
v-html=
"commit.title
H
tml"
v-html=
"commit.title
_h
tml"
></a>
<span
class=
"commit-row-message d-block d-sm-none"
>
·
{{
commit
.
short
I
d
}}
{{
commit
.
short
_i
d
}}
</span>
<button
v-if=
"commit.description
H
tml"
v-if=
"commit.description
_h
tml"
class=
"text-expander js-toggle-button"
type=
"button"
:aria-label=
"__('Toggle commit description')"
...
...
@@ -95,29 +97,29 @@ export default {
></a>
{{
s__
(
'
CommitWidget|authored
'
)
}}
<time-ago-tooltip
:time=
"commit.authored
D
ate"
:time=
"commit.authored
_d
ate"
/>
</div>
<pre
v-if=
"commit.description
H
tml"
v-if=
"commit.description
_h
tml"
class=
"commit-row-description js-toggle-content append-bottom-8"
v-html=
"commit.description
H
tml"
v-html=
"commit.description
_h
tml"
></pre>
</div>
<div
class=
"commit-actions flex-row d-none d-sm-flex"
>
<div
v-if=
"commit.signature
H
tml"
v-html=
"commit.signature
H
tml"
v-if=
"commit.signature
_h
tml"
v-html=
"commit.signature
_h
tml"
></div>
<commit-pipeline-status
v-if=
"commit.pipeline
StatusP
ath"
:endpoint=
"commit.pipeline
StatusP
ath"
v-if=
"commit.pipeline
_status_p
ath"
:endpoint=
"commit.pipeline
_status_p
ath"
/>
<div
class=
"commit-sha-group"
>
<div
class=
"label label-monospace"
v-text=
"commit.short
I
d"
v-text=
"commit.short
_i
d"
></div>
<clipboard-button
:text=
"commit.id"
...
...
app/assets/javascripts/diffs/components/compare_versions_dropdown.vue
View file @
290f8281
...
...
@@ -56,16 +56,16 @@ export default {
methods
:
{
commitsText
(
version
)
{
return
n__
(
`
${
version
.
commits
C
ount
}
commit,`
,
`
${
version
.
commits
C
ount
}
commits,`
,
version
.
commits
C
ount
,
`
${
version
.
commits
_c
ount
}
commit,`
,
`
${
version
.
commits
_c
ount
}
commits,`
,
version
.
commits
_c
ount
,
);
},
href
(
version
)
{
if
(
this
.
showCommitCount
)
{
return
version
.
version
P
ath
;
return
version
.
version
_p
ath
;
}
return
version
.
compare
P
ath
;
return
version
.
compare
_p
ath
;
},
versionName
(
version
)
{
if
(
this
.
isLatest
(
version
))
{
...
...
@@ -74,7 +74,7 @@ export default {
if
(
this
.
targetBranch
&&
(
this
.
isBase
(
version
)
||
!
version
))
{
return
this
.
targetBranch
.
branchName
;
}
return
`version
${
version
.
version
I
ndex
}
`
;
return
`version
${
version
.
version
_i
ndex
}
`
;
},
isActive
(
version
)
{
if
(
!
version
)
{
...
...
@@ -84,11 +84,11 @@ export default {
if
(
this
.
targetBranch
)
{
return
(
(
this
.
isBase
(
version
)
&&
!
this
.
startVersion
)
||
(
this
.
startVersion
&&
this
.
startVersion
.
version
Index
===
version
.
versionI
ndex
)
(
this
.
startVersion
&&
this
.
startVersion
.
version
_index
===
version
.
version_i
ndex
)
);
}
return
version
.
version
Index
===
this
.
mergeRequestVersion
.
versionI
ndex
;
return
version
.
version
_index
===
this
.
mergeRequestVersion
.
version_i
ndex
;
},
isBase
(
version
)
{
if
(
!
version
||
!
this
.
targetBranch
)
{
...
...
@@ -98,7 +98,7 @@ export default {
},
isLatest
(
version
)
{
return
(
this
.
mergeRequestVersion
&&
version
.
version
Index
===
this
.
targetVersions
[
0
].
versionI
ndex
this
.
mergeRequestVersion
&&
version
.
version
_index
===
this
.
targetVersions
[
0
].
version_i
ndex
);
},
},
...
...
@@ -142,7 +142,7 @@ export default {
</div>
<div>
<small
class=
"commit-sha"
>
{{ version.truncated
CommitS
ha }}
{{ version.truncated
_commit_s
ha }}
</small>
</div>
<div>
...
...
@@ -151,8 +151,8 @@ export default {
{{
commitsText
(
version
)
}}
</
template
>
<time-ago
v-if=
"version.created
A
t"
:time=
"version.created
A
t"
v-if=
"version.created
_a
t"
:time=
"version.created
_a
t"
class=
"js-timeago js-timeago-render"
/>
</small>
...
...
app/assets/javascripts/diffs/components/diff_content.vue
View file @
290f8281
...
...
@@ -39,7 +39,7 @@ export default {
return
this
.
diffFile
.
viewer
.
name
===
'
text
'
;
},
diffFileCommentForm
()
{
return
this
.
getCommentFormForDiffFile
(
this
.
diffFile
.
file
H
ash
);
return
this
.
getCommentFormForDiffFile
(
this
.
diffFile
.
file
_h
ash
);
},
showNotesContainer
()
{
return
this
.
diffFile
.
discussions
.
length
||
this
.
diffFileCommentForm
;
...
...
@@ -73,28 +73,28 @@ export default {
<inline-diff-view
v-if=
"isInlineView"
:diff-file=
"diffFile"
:diff-lines=
"diffFile.highlighted
DiffL
ines || []"
:diff-lines=
"diffFile.highlighted
_diff_l
ines || []"
/>
<parallel-diff-view
v-if=
"isParallelView"
:diff-file=
"diffFile"
:diff-lines=
"diffFile.parallel
DiffL
ines || []"
:diff-lines=
"diffFile.parallel
_diff_l
ines || []"
/>
</
template
>
<diff-viewer
v-else
:diff-mode=
"diffMode"
:new-path=
"diffFile.new
P
ath"
:new-sha=
"diffFile.diff
Refs.headS
ha"
:old-path=
"diffFile.old
P
ath"
:old-sha=
"diffFile.diff
Refs.baseS
ha"
:file-hash=
"diffFile.file
H
ash"
:new-path=
"diffFile.new
_p
ath"
:new-sha=
"diffFile.diff
_refs.head_s
ha"
:old-path=
"diffFile.old
_p
ath"
:old-sha=
"diffFile.diff
_refs.base_s
ha"
:file-hash=
"diffFile.file
_h
ash"
:project-path=
"projectPath"
>
<image-diff-overlay
slot=
"image-overlay"
:discussions=
"diffFile.discussions"
:file-hash=
"diffFile.file
H
ash"
:file-hash=
"diffFile.file
_h
ash"
:can-comment=
"getNoteableData.current_user.can_create_note"
/>
<div
...
...
@@ -115,7 +115,7 @@ export default {
:save-button-title=
"__('Comment')"
class=
"diff-comment-form new-note discussion-form discussion-form-container"
@
handleFormUpdate=
"handleSaveNote"
@
cancelForm=
"closeDiffFileCommentForm(diffFile.file
H
ash)"
@
cancelForm=
"closeDiffFileCommentForm(diffFile.file
_h
ash)"
/>
</div>
</diff-viewer>
...
...
app/assets/javascripts/diffs/components/diff_file.vue
View file @
290f8281
...
...
@@ -40,7 +40,7 @@ export default {
return
sprintf
(
__
(
'
You can %{linkStart}view the blob%{linkEnd} instead.
'
),
{
linkStart
:
`<a href="
${
_
.
escape
(
this
.
file
.
view
P
ath
)}
">`
,
linkStart
:
`<a href="
${
_
.
escape
(
this
.
file
.
view
_p
ath
)}
">`
,
linkEnd
:
'
</a>
'
,
},
false
,
...
...
@@ -49,9 +49,9 @@ export default {
showExpandMessage
()
{
return
(
this
.
isCollapsed
||
(
!
this
.
file
.
highlighted
DiffL
ines
&&
(
!
this
.
file
.
highlighted
_diff_l
ines
&&
!
this
.
isLoadingCollapsedDiff
&&
!
this
.
file
.
too
L
arge
&&
!
this
.
file
.
too
_l
arge
&&
this
.
file
.
text
)
);
},
...
...
@@ -59,9 +59,11 @@ export default {
return
this
.
isLoadingCollapsedDiff
||
(
!
this
.
file
.
renderIt
&&
!
this
.
isCollapsed
);
},
hasDiffLines
()
{
const
{
highlightedDiffLines
,
parallelDiffLines
}
=
this
.
file
;
return
highlightedDiffLines
&&
parallelDiffLines
&&
parallelDiffLines
.
length
>
0
;
return
(
this
.
file
.
highlighted_diff_lines
&&
this
.
file
.
parallel_diff_lines
&&
this
.
file
.
parallel_diff_lines
.
length
>
0
);
},
},
watch
:
{
...
...
@@ -115,9 +117,9 @@ export default {
<
template
>
<div
:id=
"file.file
H
ash"
:id=
"file.file
_h
ash"
:class=
"
{
'is-active': currentDiffFileId === file.file
H
ash
'is-active': currentDiffFileId === file.file
_h
ash
}"
class="diff-file file-holder"
>
...
...
@@ -141,7 +143,7 @@ export default {
make your changes there, and submit a merge request.
</span>
<a
:href=
"file.fork
P
ath"
:href=
"file.fork
_p
ath"
class=
"js-fork-suggestion-button btn btn-grouped btn-inverted btn-success"
>
Fork
...
...
@@ -157,7 +159,7 @@ export default {
<diff-content
v-if=
"!isCollapsed && file.renderIt"
:class=
"
{ hidden: isCollapsed || file.too
L
arge }"
:class=
"
{ hidden: isCollapsed || file.too
_l
arge }"
:diff-file="file"
/>
<gl-loading-icon
...
...
@@ -178,7 +180,7 @@ export default {
</a>
</div>
<div
v-if=
"file.too
L
arge"
v-if=
"file.too
_l
arge"
class=
"nothing-here-block diff-collapsed js-too-large-diff"
>
{{
__
(
'
This source diff could not be displayed because it is too large.
'
)
}}
...
...
app/assets/javascripts/diffs/components/diff_file_header.vue
View file @
290f8281
...
...
@@ -68,32 +68,32 @@ export default {
},
titleLink
()
{
if
(
this
.
diffFile
.
submodule
)
{
return
this
.
diffFile
.
submodule
TreeUrl
||
this
.
diffFile
.
submoduleL
ink
;
return
this
.
diffFile
.
submodule
_tree_url
||
this
.
diffFile
.
submodule_l
ink
;
}
return
this
.
discussionPath
;
},
filePath
()
{
if
(
this
.
diffFile
.
submodule
)
{
return
`
${
this
.
diffFile
.
file
P
ath
}
@
${
truncateSha
(
this
.
diffFile
.
blob
.
id
)}
`
;
return
`
${
this
.
diffFile
.
file
_p
ath
}
@
${
truncateSha
(
this
.
diffFile
.
blob
.
id
)}
`
;
}
if
(
this
.
diffFile
.
deleted
F
ile
)
{
return
sprintf
(
__
(
'
%{filePath} deleted
'
),
{
filePath
:
this
.
diffFile
.
file
P
ath
},
false
);
if
(
this
.
diffFile
.
deleted
_f
ile
)
{
return
sprintf
(
__
(
'
%{filePath} deleted
'
),
{
filePath
:
this
.
diffFile
.
file
_p
ath
},
false
);
}
return
this
.
diffFile
.
file
P
ath
;
return
this
.
diffFile
.
file
_p
ath
;
},
titleTag
()
{
return
this
.
diffFile
.
file
H
ash
?
'
a
'
:
'
span
'
;
return
this
.
diffFile
.
file
_h
ash
?
'
a
'
:
'
span
'
;
},
isUsingLfs
()
{
return
this
.
diffFile
.
stored
Externally
&&
this
.
diffFile
.
externalS
torage
===
'
lfs
'
;
return
this
.
diffFile
.
stored
_externally
&&
this
.
diffFile
.
external_s
torage
===
'
lfs
'
;
},
collapseIcon
()
{
return
this
.
expanded
?
'
chevron-down
'
:
'
chevron-right
'
;
},
viewFileButtonText
()
{
const
truncatedContentSha
=
_
.
escape
(
truncateSha
(
this
.
diffFile
.
content
S
ha
));
const
truncatedContentSha
=
_
.
escape
(
truncateSha
(
this
.
diffFile
.
content
_s
ha
));
return
sprintf
(
s__
(
'
MergeRequests|View file @ %{commitId}
'
),
{
...
...
@@ -103,7 +103,7 @@ export default {
);
},
viewReplacedFileButtonText
()
{
const
truncatedBaseSha
=
_
.
escape
(
truncateSha
(
this
.
diffFile
.
diff
Refs
.
baseS
ha
));
const
truncatedBaseSha
=
_
.
escape
(
truncateSha
(
this
.
diffFile
.
diff
_refs
.
base_s
ha
));
return
sprintf
(
s__
(
'
MergeRequests|View replaced file @ %{commitId}
'
),
{
...
...
@@ -113,7 +113,7 @@ export default {
);
},
gfmCopyText
()
{
return
`\`
${
this
.
diffFile
.
file
P
ath
}
\``
;
return
`\`
${
this
.
diffFile
.
file
_p
ath
}
\``
;
},
},
methods
:
{
...
...
@@ -164,21 +164,21 @@ export default {
aria-hidden=
"true"
css-classes=
"js-file-icon append-right-5"
/>
<span
v-if=
"diffFile.renamed
F
ile"
>
<span
v-if=
"diffFile.renamed
_f
ile"
>
<strong
v-tooltip
:title=
"diffFile.old
P
ath"
:title=
"diffFile.old
_p
ath"
class=
"file-title-name"
data-container=
"body"
v-html=
"diffFile.old
PathH
tml"
v-html=
"diffFile.old
_path_h
tml"
></strong>
→
<strong
v-tooltip
:title=
"diffFile.new
P
ath"
:title=
"diffFile.new
_p
ath"
class=
"file-title-name"
data-container=
"body"
v-html=
"diffFile.new
PathH
tml"
v-html=
"diffFile.new
_path_h
tml"
></strong>
</span>
...
...
@@ -195,16 +195,16 @@ export default {
<clipboard-button
:title=
"__('Copy file path to clipboard')"
:text=
"diffFile.file
P
ath"
:text=
"diffFile.file
_p
ath"
:gfm=
"gfmCopyText"
css-class=
"btn-default btn-transparent btn-clipboard"
/>
<small
v-if=
"diffFile.mode
C
hanged"
v-if=
"diffFile.mode
_c
hanged"
ref=
"fileMode"
>
{{
diffFile
.
a
Mode
}}
→
{{
diffFile
.
bM
ode
}}
{{
diffFile
.
a
_mode
}}
→
{{
diffFile
.
b_m
ode
}}
</small>
<span
...
...
@@ -220,7 +220,7 @@ export default {
class=
"file-actions d-none d-sm-block"
>
<template
v-if=
"diffFile.blob && diffFile.blob.readable
T
ext"
v-if=
"diffFile.blob && diffFile.blob.readable
_t
ext"
>
<button
:disabled=
"!diffHasDiscussions(diffFile)"
...
...
@@ -234,33 +234,33 @@ export default {
</button>
<edit-button
v-if=
"!diffFile.deleted
F
ile"
v-if=
"!diffFile.deleted
_f
ile"
:can-current-user-fork=
"canCurrentUserFork"
:edit-path=
"diffFile.edit
P
ath"
:can-modify-blob=
"diffFile.can
ModifyB
lob"
:edit-path=
"diffFile.edit
_p
ath"
:can-modify-blob=
"diffFile.can
_modify_b
lob"
@
showForkMessage=
"showForkMessage"
/>
</
template
>
<a
v-if=
"diffFile.replaced
ViewP
ath"
:href=
"diffFile.replaced
ViewP
ath"
v-if=
"diffFile.replaced
_view_p
ath"
:href=
"diffFile.replaced
_view_p
ath"
class=
"btn view-file js-view-file"
v-html=
"viewReplacedFileButtonText"
>
</a>
<a
:href=
"diffFile.view
P
ath"
:href=
"diffFile.view
_p
ath"
class=
"btn view-file js-view-file"
v-html=
"viewFileButtonText"
>
</a>
<a
v-if=
"diffFile.external
U
rl"
v-if=
"diffFile.external
_u
rl"
v-tooltip
:href=
"diffFile.external
U
rl"
:title=
"`View on ${diffFile.formatted
ExternalU
rl}`"
:href=
"diffFile.external
_u
rl"
:title=
"`View on ${diffFile.formatted
_external_u
rl}`"
target=
"_blank"
rel=
"noopener noreferrer"
class=
"btn btn-file-option"
...
...
app/assets/javascripts/diffs/components/diff_line_gutter_content.vue
View file @
290f8281
...
...
@@ -73,7 +73,7 @@ export default {
}),
...
mapGetters
([
'
isLoggedIn
'
]),
lineHref
()
{
return
`#
${
this
.
line
.
line
C
ode
||
''
}
`
;
return
`#
${
this
.
line
.
line
_c
ode
||
''
}
`
;
},
shouldShowCommentButton
()
{
return
(
...
...
@@ -99,7 +99,7 @@ export default {
methods
:
{
...
mapActions
(
'
diffs
'
,
[
'
loadMoreLines
'
,
'
showCommentForm
'
]),
handleCommentButton
()
{
this
.
showCommentForm
({
lineCode
:
this
.
line
.
line
C
ode
});
this
.
showCommentForm
({
lineCode
:
this
.
line
.
line
_c
ode
});
},
handleLoadMoreLines
()
{
if
(
this
.
isRequesting
)
{
...
...
@@ -108,8 +108,8 @@ export default {
this
.
isRequesting
=
true
;
const
endpoint
=
this
.
contextLinesPath
;
const
oldLineNumber
=
this
.
line
.
meta
Data
.
oldP
os
||
0
;
const
newLineNumber
=
this
.
line
.
meta
Data
.
newP
os
||
0
;
const
oldLineNumber
=
this
.
line
.
meta
_data
.
old_p
os
||
0
;
const
newLineNumber
=
this
.
line
.
meta
_data
.
new_p
os
||
0
;
const
offset
=
newLineNumber
-
oldLineNumber
;
const
bottom
=
this
.
isBottom
;
const
{
fileHash
}
=
this
;
...
...
@@ -125,12 +125,12 @@ export default {
to
=
lineNumber
+
UNFOLD_COUNT
;
}
else
{
const
diffFile
=
utils
.
findDiffFile
(
this
.
diffFiles
,
this
.
fileHash
);
const
indexForInline
=
utils
.
findIndexInInlineLines
(
diffFile
.
highlighted
DiffL
ines
,
{
const
indexForInline
=
utils
.
findIndexInInlineLines
(
diffFile
.
highlighted
_diff_l
ines
,
{
oldLineNumber
,
newLineNumber
,
});
const
prevLine
=
diffFile
.
highlighted
DiffL
ines
[
indexForInline
-
2
];
const
prevLineNumber
=
(
prevLine
&&
prevLine
.
new
L
ine
)
||
0
;
const
prevLine
=
diffFile
.
highlighted
_diff_l
ines
[
indexForInline
-
2
];
const
prevLineNumber
=
(
prevLine
&&
prevLine
.
new
_l
ine
)
||
0
;
if
(
since
<=
prevLineNumber
+
1
)
{
since
=
prevLineNumber
+
1
;
...
...
app/assets/javascripts/diffs/components/diff_line_note_form.vue
View file @
290f8281
...
...
@@ -54,7 +54,7 @@ export default {
this
.
noteableData
.
diff_head_sha
,
DIFF_NOTE_TYPE
,
this
.
noteableData
.
source_project_id
,
this
.
line
.
line
C
ode
,
this
.
line
.
line
_c
ode
,
];
this
.
initAutoSave
(
this
.
noteableData
,
keys
);
...
...
@@ -73,7 +73,7 @@ export default {
}
this
.
cancelCommentForm
({
lineCode
:
this
.
line
.
line
C
ode
,
lineCode
:
this
.
line
.
line
_c
ode
,
});
this
.
$nextTick
(()
=>
{
this
.
resetAutoSave
();
...
...
@@ -95,7 +95,7 @@ export default {
<note-form
ref=
"noteForm"
:is-editing=
"true"
:line-code=
"line.line
C
ode"
:line-code=
"line.line
_c
ode"
save-button-title=
"Comment"
class=
"diff-comment-form"
@
handleFormUpdateAddToReview=
"addToReview"
...
...
app/assets/javascripts/diffs/components/diff_table_cell.vue
View file @
290f8281
...
...
@@ -96,9 +96,7 @@ export default {
};
},
lineNumber
()
{
const
{
lineType
}
=
this
;
return
lineType
===
OLD_LINE_TYPE
?
this
.
line
.
oldLine
:
this
.
line
.
newLine
;
return
this
.
lineType
===
OLD_LINE_TYPE
?
this
.
line
.
old_line
:
this
.
line
.
new_line
;
},
},
};
...
...
app/assets/javascripts/diffs/components/inline_diff_comment_row.vue
View file @
290f8281
...
...
@@ -48,7 +48,7 @@ export default {
:discussions=
"line.discussions"
/>
<diff-line-note-form
v-if=
"diffLineCommentForms[line.line
C
ode]"
v-if=
"diffLineCommentForms[line.line
_c
ode]"
:diff-file-hash=
"diffFileHash"
:line=
"line"
:note-target-line=
"line"
...
...
app/assets/javascripts/diffs/components/inline_diff_table_row.vue
View file @
290f8281
...
...
@@ -52,9 +52,7 @@ export default {
};
},
inlineRowId
()
{
const
{
lineCode
,
oldLine
,
newLine
}
=
this
.
line
;
return
lineCode
||
`
${
this
.
fileHash
}
_
${
oldLine
}
_
${
newLine
}
`
;
return
this
.
line
.
line_code
||
`
${
this
.
fileHash
}
_
${
this
.
line
.
old_line
}
_
${
this
.
line
.
new_line
}
`
;
},
},
created
()
{
...
...
@@ -107,7 +105,7 @@ export default {
<td
:class=
"line.type"
class=
"line_content"
v-html=
"line.rich
T
ext"
v-html=
"line.rich
_t
ext"
>
</td>
</tr>
...
...
app/assets/javascripts/diffs/components/inline_diff_view.vue
View file @
290f8281
...
...
@@ -46,16 +46,16 @@ export default {
v-for=
"(line, index) in diffLines"
>
<inline-diff-table-row
:key=
"line.line
C
ode"
:file-hash=
"diffFile.file
H
ash"
:context-lines-path=
"diffFile.context
LinesP
ath"
:key=
"line.line
_c
ode"
:file-hash=
"diffFile.file
_h
ash"
:context-lines-path=
"diffFile.context
_lines_p
ath"
:line=
"line"
:is-bottom=
"index + 1 === diffLinesLength"
/>
<inline-diff-comment-row
v-if=
"shouldRenderInlineCommentRow(line)"
:key=
"index"
:diff-file-hash=
"diffFile.file
H
ash"
:diff-file-hash=
"diffFile.file
_h
ash"
:line=
"line"
:line-index=
"index"
/>
...
...
app/assets/javascripts/diffs/components/parallel_diff_comment_row.vue
View file @
290f8281
...
...
@@ -27,10 +27,10 @@ export default {
diffLineCommentForms
:
state
=>
state
.
diffs
.
diffLineCommentForms
,
}),
leftLineCode
()
{
return
this
.
line
.
left
&&
this
.
line
.
left
.
line
C
ode
;
return
this
.
line
.
left
&&
this
.
line
.
left
.
line
_c
ode
;
},
rightLineCode
()
{
return
this
.
line
.
right
&&
this
.
line
.
right
.
line
C
ode
;
return
this
.
line
.
right
&&
this
.
line
.
right
.
line
_c
ode
;
},
hasExpandedDiscussionOnLeft
()
{
return
this
.
line
.
left
&&
this
.
line
.
left
.
discussions
...
...
app/assets/javascripts/diffs/components/parallel_diff_table_row.vue
View file @
290f8281
...
...
@@ -120,11 +120,11 @@ export default {
class=
"diff-line-num old_line"
/>
<td
:id=
"line.left.line
C
ode"
:id=
"line.left.line
_c
ode"
:class=
"parallelViewLeftLineType"
class=
"line_content parallel left-side"
@
mousedown.native=
"handleParallelLineMouseDown"
v-html=
"line.left.rich
T
ext"
v-html=
"line.left.rich
_t
ext"
>
</td>
</
template
>
...
...
@@ -146,11 +146,11 @@ export default {
class=
"diff-line-num new_line"
/>
<td
:id=
"line.right.line
C
ode"
:id=
"line.right.line
_c
ode"
:class=
"line.right.type"
class=
"line_content parallel right-side"
@
mousedown.native=
"handleParallelLineMouseDown"
v-html=
"line.right.rich
T
ext"
v-html=
"line.right.rich
_t
ext"
>
</td>
</
template
>
...
...
app/assets/javascripts/diffs/components/parallel_diff_view.vue
View file @
290f8281
...
...
@@ -49,8 +49,8 @@ export default {
>
<parallel-diff-table-row
:key=
"index"
:file-hash=
"diffFile.file
H
ash"
:context-lines-path=
"diffFile.context
LinesP
ath"
:file-hash=
"diffFile.file
_h
ash"
:context-lines-path=
"diffFile.context
_lines_p
ath"
:line=
"line"
:is-bottom=
"index + 1 === diffLinesLength"
/>
...
...
@@ -58,7 +58,7 @@ export default {
v-if=
"shouldRenderParallelCommentRow(line)"
:key=
"`dcr-$
{index}`"
:line="line"
:diff-file-hash="diffFile.file
H
ash"
:diff-file-hash="diffFile.file
_h
ash"
:line-index="index"
/>
<parallel-draft-comment-row
...
...
app/assets/javascripts/diffs/index.js
View file @
290f8281
import
Vue
from
'
vue
'
;
import
{
mapState
}
from
'
vuex
'
;
import
{
convertObjectPropsToCamelCase
}
from
'
~/lib/utils/common_utils
'
;
import
diffsApp
from
'
./components/app.vue
'
;
export
default
function
initDiffsApp
(
store
)
{
...
...
@@ -17,9 +16,7 @@ export default function initDiffsApp(store) {
return
{
endpoint
:
dataset
.
endpoint
,
projectPath
:
dataset
.
projectPath
,
currentUser
:
convertObjectPropsToCamelCase
(
JSON
.
parse
(
dataset
.
currentUserData
),
{
deep
:
true
,
}),
currentUser
:
JSON
.
parse
(
dataset
.
currentUserData
)
||
{},
};
},
computed
:
{
...
...
app/assets/javascripts/diffs/store/actions.js
View file @
290f8281
...
...
@@ -50,8 +50,8 @@ export const assignDiscussionsToDiff = (
};
export
const
removeDiscussionsFromDiff
=
({
commit
},
removeDiscussion
)
=>
{
const
{
file
H
ash
,
line_code
,
id
}
=
removeDiscussion
;
commit
(
types
.
REMOVE_LINE_DISCUSSIONS_FOR_FILE
,
{
fileHash
,
lineCode
:
line_code
,
id
});
const
{
file
_h
ash
,
line_code
,
id
}
=
removeDiscussion
;
commit
(
types
.
REMOVE_LINE_DISCUSSIONS_FOR_FILE
,
{
fileHash
:
file_hash
,
lineCode
:
line_code
,
id
});
};
export
const
startRenderDiffsQueue
=
({
state
,
commit
})
=>
{
...
...
@@ -189,7 +189,7 @@ export const saveDiffDiscussion = ({ dispatch }, { note, formData }) => {
return
dispatch
(
'
saveNote
'
,
postData
,
{
root
:
true
})
.
then
(
result
=>
dispatch
(
'
updateDiscussion
'
,
result
.
discussion
,
{
root
:
true
}))
.
then
(
discussion
=>
dispatch
(
'
assignDiscussionsToDiff
'
,
[
discussion
]))
.
then
(()
=>
dispatch
(
'
closeDiffFileCommentForm
'
,
formData
.
diffFile
.
file
H
ash
))
.
then
(()
=>
dispatch
(
'
closeDiffFileCommentForm
'
,
formData
.
diffFile
.
file
_h
ash
))
.
then
(()
=>
dispatch
(
'
startTaskList
'
,
null
,
{
root
:
true
}))
.
catch
(()
=>
createFlash
(
s__
(
'
MergeRequests|Saving the comment failed
'
)));
};
...
...
app/assets/javascripts/diffs/store/getters.js
View file @
290f8281
import
_
from
'
underscore
'
;
import
{
PARALLEL_DIFF_VIEW_TYPE
,
INLINE_DIFF_VIEW_TYPE
}
from
'
../constants
'
;
export
const
isParallelView
=
state
=>
state
.
diffViewType
===
PARALLEL_DIFF_VIEW_TYPE
;
...
...
@@ -68,8 +67,7 @@ export const diffHasDiscussions = (state, getters) => diff =>
*/
export
const
getDiffFileDiscussions
=
(
state
,
getters
,
rootState
,
rootGetters
)
=>
diff
=>
rootGetters
.
discussions
.
filter
(
discussion
=>
discussion
.
diff_discussion
&&
_
.
isEqual
(
discussion
.
diff_file
.
file_hash
,
diff
.
fileHash
),
discussion
=>
discussion
.
diff_discussion
&&
discussion
.
diff_file
.
file_hash
===
diff
.
file_hash
,
)
||
[];
export
const
shouldRenderParallelCommentRow
=
state
=>
line
=>
{
...
...
@@ -90,14 +88,14 @@ export const shouldRenderParallelCommentRow = state => line => {
return
true
;
}
const
hasCommentFormOnLeft
=
line
.
left
&&
state
.
diffLineCommentForms
[
line
.
left
.
line
C
ode
];
const
hasCommentFormOnRight
=
line
.
right
&&
state
.
diffLineCommentForms
[
line
.
right
.
line
C
ode
];
const
hasCommentFormOnLeft
=
line
.
left
&&
state
.
diffLineCommentForms
[
line
.
left
.
line
_c
ode
];
const
hasCommentFormOnRight
=
line
.
right
&&
state
.
diffLineCommentForms
[
line
.
right
.
line
_c
ode
];
return
hasCommentFormOnLeft
||
hasCommentFormOnRight
;
};
export
const
shouldRenderInlineCommentRow
=
state
=>
line
=>
{
if
(
state
.
diffLineCommentForms
[
line
.
line
C
ode
])
return
true
;
if
(
state
.
diffLineCommentForms
[
line
.
line
_c
ode
])
return
true
;
if
(
!
line
.
discussions
||
line
.
discussions
.
length
===
0
)
{
return
false
;
...
...
@@ -108,7 +106,7 @@ export const shouldRenderInlineCommentRow = state => line => {
// prevent babel-plugin-rewire from generating an invalid default during karma∂ tests
export
const
getDiffFileByHash
=
state
=>
fileHash
=>
state
.
diffFiles
.
find
(
file
=>
file
.
file
H
ash
===
fileHash
);
state
.
diffFiles
.
find
(
file
=>
file
.
file
_h
ash
===
fileHash
);
export
const
allBlobs
=
state
=>
Object
.
values
(
state
.
treeEntries
).
filter
(
f
=>
f
.
type
===
'
blob
'
);
...
...
app/assets/javascripts/diffs/store/mutations.js
View file @
290f8281
...
...
@@ -23,12 +23,11 @@ export default {
},
[
types
.
SET_DIFF_DATA
](
state
,
data
)
{
const
diffData
=
convertObjectPropsToCamelCase
(
data
,
{
deep
:
true
});
prepareDiffData
(
diffData
);
const
{
tree
,
treeEntries
}
=
generateTreeList
(
diffData
.
diffFiles
);
prepareDiffData
(
data
);
const
{
tree
,
treeEntries
}
=
generateTreeList
(
data
.
diff_files
);
Object
.
assign
(
state
,
{
...
diffData
,
...
convertObjectPropsToCamelCase
(
data
)
,
tree
:
sortTree
(
tree
),
treeEntries
,
});
...
...
@@ -42,7 +41,7 @@ export default {
[
types
.
SET_MERGE_REQUEST_DIFFS
](
state
,
mergeRequestDiffs
)
{
Object
.
assign
(
state
,
{
mergeRequestDiffs
:
convertObjectPropsToCamelCase
(
mergeRequestDiffs
,
{
deep
:
true
})
,
mergeRequestDiffs
,
});
},
...
...
@@ -62,19 +61,18 @@ export default {
const
{
lineNumbers
,
contextLines
,
fileHash
}
=
options
;
const
{
bottom
}
=
options
.
params
;
const
diffFile
=
findDiffFile
(
state
.
diffFiles
,
fileHash
);
const
{
highlightedDiffLines
,
parallelDiffLines
}
=
diffFile
;
removeMatchLine
(
diffFile
,
lineNumbers
,
bottom
);
const
lines
=
addLineReferences
(
contextLines
,
lineNumbers
,
bottom
).
map
(
line
=>
({
...
line
,
line
Code
:
line
.
lineCode
||
`
${
fileHash
}
_
${
line
.
oldLine
}
_
${
line
.
newL
ine
}
`
,
line
_code
:
line
.
line_code
||
`
${
fileHash
}
_
${
line
.
old_line
}
_
${
line
.
new_l
ine
}
`
,
discussions
:
line
.
discussions
||
[],
}));
addContextLines
({
inlineLines
:
highlightedDiffL
ines
,
parallelLines
:
parallelDiffL
ines
,
inlineLines
:
diffFile
.
highlighted_diff_l
ines
,
parallelLines
:
diffFile
.
parallel_diff_l
ines
,
contextLines
:
lines
,
bottom
,
lineNumbers
,
...
...
@@ -82,10 +80,9 @@ export default {
},
[
types
.
ADD_COLLAPSED_DIFFS
](
state
,
{
file
,
data
})
{
const
normalizedData
=
convertObjectPropsToCamelCase
(
data
,
{
deep
:
true
});
prepareDiffData
(
normalizedData
);
const
[
newFileData
]
=
normalizedData
.
diffFiles
.
filter
(
f
=>
f
.
fileHash
===
file
.
fileHash
);
const
selectedFile
=
state
.
diffFiles
.
find
(
f
=>
f
.
fileHash
===
file
.
fileHash
);
prepareDiffData
(
data
);
const
[
newFileData
]
=
data
.
diff_files
.
filter
(
f
=>
f
.
file_hash
===
file
.
file_hash
);
const
selectedFile
=
state
.
diffFiles
.
find
(
f
=>
f
.
file_hash
===
file
.
file_hash
);
Object
.
assign
(
selectedFile
,
{
...
newFileData
});
},
...
...
@@ -101,20 +98,20 @@ export default {
const
discussionLineCode
=
discussion
.
line_code
;
const
fileHash
=
discussion
.
diff_file
.
file_hash
;
const
lineCheck
=
({
lineCode
})
=>
line
C
ode
===
discussionLineCode
&&
const
lineCheck
=
line
=>
line
.
line_c
ode
===
discussionLineCode
&&
isDiscussionApplicableToLine
({
discussion
,
diffPosition
:
diffPositionByLineCode
[
line
C
ode
],
diffPosition
:
diffPositionByLineCode
[
line
.
line_c
ode
],
latestDiff
,
});
state
.
diffFiles
=
state
.
diffFiles
.
map
(
diffFile
=>
{
if
(
diffFile
.
file
H
ash
===
fileHash
)
{
if
(
diffFile
.
file
_h
ash
===
fileHash
)
{
const
file
=
{
...
diffFile
};
if
(
file
.
highlighted
DiffL
ines
)
{
file
.
highlighted
DiffLines
=
file
.
highlightedDiffL
ines
.
map
(
line
=>
{
if
(
file
.
highlighted
_diff_l
ines
)
{
file
.
highlighted
_diff_lines
=
file
.
highlighted_diff_l
ines
.
map
(
line
=>
{
if
(
lineCheck
(
line
))
{
return
{
...
line
,
...
...
@@ -126,8 +123,8 @@ export default {
});
}
if
(
file
.
parallel
DiffL
ines
)
{
file
.
parallel
DiffLines
=
file
.
parallelDiffL
ines
.
map
(
line
=>
{
if
(
file
.
parallel
_diff_l
ines
)
{
file
.
parallel
_diff_lines
=
file
.
parallel_diff_l
ines
.
map
(
line
=>
{
const
left
=
line
.
left
&&
lineCheck
(
line
.
left
);
const
right
=
line
.
right
&&
lineCheck
(
line
.
right
);
...
...
@@ -148,7 +145,7 @@ export default {
});
}
if
(
!
file
.
parallel
DiffLines
||
!
file
.
highlightedDiffL
ines
)
{
if
(
!
file
.
parallel
_diff_lines
||
!
file
.
highlighted_diff_l
ines
)
{
file
.
discussions
=
file
.
discussions
.
concat
(
discussion
);
}
...
...
@@ -160,16 +157,16 @@ export default {
},
[
types
.
REMOVE_LINE_DISCUSSIONS_FOR_FILE
](
state
,
{
fileHash
,
lineCode
,
id
})
{
const
selectedFile
=
state
.
diffFiles
.
find
(
f
=>
f
.
file
H
ash
===
fileHash
);
const
selectedFile
=
state
.
diffFiles
.
find
(
f
=>
f
.
file
_h
ash
===
fileHash
);
if
(
selectedFile
)
{
if
(
selectedFile
.
parallel
DiffL
ines
)
{
const
targetLine
=
selectedFile
.
parallel
DiffL
ines
.
find
(
if
(
selectedFile
.
parallel
_diff_l
ines
)
{
const
targetLine
=
selectedFile
.
parallel
_diff_l
ines
.
find
(
line
=>
(
line
.
left
&&
line
.
left
.
line
C
ode
===
lineCode
)
||
(
line
.
right
&&
line
.
right
.
line
C
ode
===
lineCode
),
(
line
.
left
&&
line
.
left
.
line
_c
ode
===
lineCode
)
||
(
line
.
right
&&
line
.
right
.
line
_c
ode
===
lineCode
),
);
if
(
targetLine
)
{
const
side
=
targetLine
.
left
&&
targetLine
.
left
.
line
C
ode
===
lineCode
?
'
left
'
:
'
right
'
;
const
side
=
targetLine
.
left
&&
targetLine
.
left
.
line
_c
ode
===
lineCode
?
'
left
'
:
'
right
'
;
Object
.
assign
(
targetLine
[
side
],
{
discussions
:
[],
...
...
@@ -177,9 +174,9 @@ export default {
}
}
if
(
selectedFile
.
highlighted
DiffL
ines
)
{
const
targetInlineLine
=
selectedFile
.
highlighted
DiffL
ines
.
find
(
line
=>
line
.
line
C
ode
===
lineCode
,
if
(
selectedFile
.
highlighted
_diff_l
ines
)
{
const
targetInlineLine
=
selectedFile
.
highlighted
_diff_l
ines
.
find
(
line
=>
line
.
line
_c
ode
===
lineCode
,
);
if
(
targetInlineLine
)
{
...
...
app/assets/javascripts/diffs/store/utils.js
View file @
290f8281
import
_
from
'
underscore
'
;
import
{
convertObjectPropsToCamelCase
}
from
'
~/lib/utils/common_utils
'
;
import
{
diffModes
}
from
'
~/ide/constants
'
;
import
{
LINE_POSITION_LEFT
,
...
...
@@ -15,7 +14,7 @@ import {
}
from
'
../constants
'
;
export
function
findDiffFile
(
files
,
hash
)
{
return
files
.
filter
(
file
=>
file
.
file
H
ash
===
hash
)[
0
];
return
files
.
filter
(
file
=>
file
.
file
_h
ash
===
hash
)[
0
];
}
export
const
getReversePosition
=
linePosition
=>
{
...
...
@@ -39,14 +38,14 @@ export function getFormData(params) {
}
=
params
;
const
position
=
JSON
.
stringify
({
base_sha
:
diffFile
.
diff
Refs
.
baseS
ha
,
start_sha
:
diffFile
.
diff
Refs
.
startS
ha
,
head_sha
:
diffFile
.
diff
Refs
.
headS
ha
,
old_path
:
diffFile
.
old
P
ath
,
new_path
:
diffFile
.
new
P
ath
,
base_sha
:
diffFile
.
diff
_refs
.
base_s
ha
,
start_sha
:
diffFile
.
diff
_refs
.
start_s
ha
,
head_sha
:
diffFile
.
diff
_refs
.
head_s
ha
,
old_path
:
diffFile
.
old
_p
ath
,
new_path
:
diffFile
.
new
_p
ath
,
position_type
:
positionType
||
TEXT_DIFF_POSITION_TYPE
,
old_line
:
noteTargetLine
?
noteTargetLine
.
old
L
ine
:
null
,
new_line
:
noteTargetLine
?
noteTargetLine
.
new
L
ine
:
null
,
old_line
:
noteTargetLine
?
noteTargetLine
.
old
_l
ine
:
null
,
new_line
:
noteTargetLine
?
noteTargetLine
.
new
_l
ine
:
null
,
x
:
params
.
x
,
y
:
params
.
y
,
width
:
params
.
width
,
...
...
@@ -56,7 +55,7 @@ export function getFormData(params) {
const
postData
=
{
view
:
diffViewType
,
line_type
:
linePosition
===
LINE_POSITION_RIGHT
?
NEW_LINE_TYPE
:
OLD_LINE_TYPE
,
merge_request_diff_head_sha
:
diffFile
.
diff
Refs
.
headS
ha
,
merge_request_diff_head_sha
:
diffFile
.
diff
_refs
.
head_s
ha
,
in_reply_to_discussion_id
:
''
,
note_project_id
:
''
,
target_type
:
noteableData
.
targetType
,
...
...
@@ -69,10 +68,10 @@ export function getFormData(params) {
noteable_id
:
noteableData
.
id
,
commit_id
:
''
,
type
:
diffFile
.
diff
Refs
.
startSha
&&
diffFile
.
diffRefs
.
headS
ha
diffFile
.
diff
_refs
.
start_sha
&&
diffFile
.
diff_refs
.
head_s
ha
?
DIFF_NOTE_TYPE
:
LEGACY_DIFF_NOTE_TYPE
,
line_code
:
noteTargetLine
?
noteTargetLine
.
line
C
ode
:
null
,
line_code
:
noteTargetLine
?
noteTargetLine
.
line
_c
ode
:
null
,
},
};
...
...
@@ -93,7 +92,7 @@ export const findIndexInInlineLines = (lines, lineNumbers) => {
return
_
.
findIndex
(
lines
,
line
=>
line
.
old
Line
===
oldLineNumber
&&
line
.
newL
ine
===
newLineNumber
,
line
=>
line
.
old
_line
===
oldLineNumber
&&
line
.
new_l
ine
===
newLineNumber
,
);
};
...
...
@@ -105,18 +104,18 @@ export const findIndexInParallelLines = (lines, lineNumbers) => {
line
=>
line
.
left
&&
line
.
right
&&
line
.
left
.
old
L
ine
===
oldLineNumber
&&
line
.
right
.
new
L
ine
===
newLineNumber
,
line
.
left
.
old
_l
ine
===
oldLineNumber
&&
line
.
right
.
new
_l
ine
===
newLineNumber
,
);
};
export
function
removeMatchLine
(
diffFile
,
lineNumbers
,
bottom
)
{
const
indexForInline
=
findIndexInInlineLines
(
diffFile
.
highlighted
DiffL
ines
,
lineNumbers
);
const
indexForParallel
=
findIndexInParallelLines
(
diffFile
.
parallel
DiffL
ines
,
lineNumbers
);
const
indexForInline
=
findIndexInInlineLines
(
diffFile
.
highlighted
_diff_l
ines
,
lineNumbers
);
const
indexForParallel
=
findIndexInParallelLines
(
diffFile
.
parallel
_diff_l
ines
,
lineNumbers
);
const
factor
=
bottom
?
1
:
-
1
;
diffFile
.
highlighted
DiffL
ines
.
splice
(
indexForInline
+
factor
,
1
);
diffFile
.
parallel
DiffL
ines
.
splice
(
indexForParallel
+
factor
,
1
);
diffFile
.
highlighted
_diff_l
ines
.
splice
(
indexForInline
+
factor
,
1
);
diffFile
.
parallel
_diff_l
ines
.
splice
(
indexForParallel
+
factor
,
1
);
}
export
function
addLineReferences
(
lines
,
lineNumbers
,
bottom
)
{
...
...
@@ -125,18 +124,16 @@ export function addLineReferences(lines, lineNumbers, bottom) {
let
matchLineIndex
=
-
1
;
const
linesWithNumbers
=
lines
.
map
((
l
,
index
)
=>
{
const
line
=
convertObjectPropsToCamelCase
(
l
);
if
(
line
.
type
===
MATCH_LINE_TYPE
)
{
if
(
l
.
type
===
MATCH_LINE_TYPE
)
{
matchLineIndex
=
index
;
}
else
{
Object
.
assign
(
l
ine
,
{
old
L
ine
:
bottom
?
oldLineNumber
+
index
+
1
:
oldLineNumber
+
index
-
lineCount
,
new
L
ine
:
bottom
?
newLineNumber
+
index
+
1
:
newLineNumber
+
index
-
lineCount
,
Object
.
assign
(
l
,
{
old
_l
ine
:
bottom
?
oldLineNumber
+
index
+
1
:
oldLineNumber
+
index
-
lineCount
,
new
_l
ine
:
bottom
?
newLineNumber
+
index
+
1
:
newLineNumber
+
index
-
lineCount
,
});
}
return
l
ine
;
return
l
;
});
if
(
matchLineIndex
>
-
1
)
{
...
...
@@ -146,9 +143,9 @@ export function addLineReferences(lines, lineNumbers, bottom) {
:
linesWithNumbers
[
matchLineIndex
+
1
];
Object
.
assign
(
line
,
{
meta
D
ata
:
{
old
Pos
:
targetLine
.
oldL
ine
,
new
Pos
:
targetLine
.
newL
ine
,
meta
_d
ata
:
{
old
_pos
:
targetLine
.
old_l
ine
,
new
_pos
:
targetLine
.
new_l
ine
,
},
});
}
...
...
@@ -187,11 +184,11 @@ export function trimFirstCharOfLineContent(line = {}) {
const
parsedLine
=
Object
.
assign
({},
line
);
if
(
line
.
rich
T
ext
)
{
const
firstChar
=
parsedLine
.
rich
T
ext
.
charAt
(
0
);
if
(
line
.
rich
_t
ext
)
{
const
firstChar
=
parsedLine
.
rich
_t
ext
.
charAt
(
0
);
if
(
firstChar
===
'
'
||
firstChar
===
'
+
'
||
firstChar
===
'
-
'
)
{
parsedLine
.
rich
Text
=
line
.
richT
ext
.
substring
(
1
);
parsedLine
.
rich
_text
=
line
.
rich_t
ext
.
substring
(
1
);
}
}
...
...
@@ -201,15 +198,15 @@ export function trimFirstCharOfLineContent(line = {}) {
// This prepares and optimizes the incoming diff data from the server
// by setting up incremental rendering and removing unneeded data
export
function
prepareDiffData
(
diffData
)
{
const
filesLength
=
diffData
.
diff
F
iles
.
length
;
const
filesLength
=
diffData
.
diff
_f
iles
.
length
;
let
showingLines
=
0
;
for
(
let
i
=
0
;
i
<
filesLength
;
i
+=
1
)
{
const
file
=
diffData
.
diff
F
iles
[
i
];
const
file
=
diffData
.
diff
_f
iles
[
i
];
if
(
file
.
parallel
DiffL
ines
)
{
const
linesLength
=
file
.
parallel
DiffL
ines
.
length
;
if
(
file
.
parallel
_diff_l
ines
)
{
const
linesLength
=
file
.
parallel
_diff_l
ines
.
length
;
for
(
let
u
=
0
;
u
<
linesLength
;
u
+=
1
)
{
const
line
=
file
.
parallel
DiffL
ines
[
u
];
const
line
=
file
.
parallel
_diff_l
ines
[
u
];
if
(
line
.
left
)
{
line
.
left
=
trimFirstCharOfLineContent
(
line
.
left
);
}
...
...
@@ -219,13 +216,13 @@ export function prepareDiffData(diffData) {
}
}
if
(
file
.
highlighted
DiffL
ines
)
{
const
linesLength
=
file
.
highlighted
DiffL
ines
.
length
;
if
(
file
.
highlighted
_diff_l
ines
)
{
const
linesLength
=
file
.
highlighted
_diff_l
ines
.
length
;
for
(
let
u
=
0
;
u
<
linesLength
;
u
+=
1
)
{
const
line
=
file
.
highlighted
DiffL
ines
[
u
];
const
line
=
file
.
highlighted
_diff_l
ines
[
u
];
Object
.
assign
(
line
,
{
...
trimFirstCharOfLineContent
(
line
)
});
}
showingLines
+=
file
.
parallel
DiffL
ines
.
length
;
showingLines
+=
file
.
parallel
_diff_l
ines
.
length
;
}
Object
.
assign
(
file
,
{
...
...
@@ -238,26 +235,21 @@ export function prepareDiffData(diffData) {
export
function
getDiffPositionByLineCode
(
diffFiles
)
{
return
diffFiles
.
reduce
((
acc
,
diffFile
)
=>
{
const
{
baseSha
,
headSha
,
startSha
}
=
diffFile
.
diffRefs
;
const
{
newPath
,
oldPath
}
=
diffFile
;
// We can only use highlightedDiffLines to create the map of diff lines because
// highlightedDiffLines will also include every parallel diff line in it.
if
(
diffFile
.
highlightedDiffLines
)
{
diffFile
.
highlightedDiffLines
.
forEach
(
line
=>
{
const
{
lineCode
,
oldLine
,
newLine
}
=
line
;
if
(
lineCode
)
{
acc
[
lineCode
]
=
{
baseSha
,
headSha
,
startSha
,
newPath
,
oldPath
,
oldLine
,
newLine
,
lineCode
,
positionType
:
'
text
'
,
if
(
diffFile
.
highlighted_diff_lines
)
{
diffFile
.
highlighted_diff_lines
.
forEach
(
line
=>
{
if
(
line
.
line_code
)
{
acc
[
line
.
line_code
]
=
{
base_sha
:
diffFile
.
diff_refs
.
base_sha
,
head_sha
:
diffFile
.
diff_refs
.
head_sha
,
start_sha
:
diffFile
.
diff_refs
.
start_sha
,
new_path
:
diffFile
.
new_path
,
old_path
:
diffFile
.
old_path
,
old_line
:
line
.
old_line
,
new_line
:
line
.
new_line
,
line_code
:
line
.
line_code
,
position_type
:
'
text
'
,
};
}
});
...
...
@@ -270,30 +262,30 @@ export function getDiffPositionByLineCode(diffFiles) {
// This method will check whether the discussion is still applicable
// to the diff line in question regarding different versions of the MR
export
function
isDiscussionApplicableToLine
({
discussion
,
diffPosition
,
latestDiff
})
{
const
{
line
C
ode
,
...
diffPositionCopy
}
=
diffPosition
;
const
{
line
_c
ode
,
...
diffPositionCopy
}
=
diffPosition
;
if
(
discussion
.
original_position
&&
discussion
.
position
)
{
const
originalRefs
=
convertObjectPropsToCamelCase
(
discussion
.
original_position
)
;
const
refs
=
convertObjectPropsToCamelCase
(
discussion
.
position
)
;
const
originalRefs
=
discussion
.
original_position
;
const
refs
=
discussion
.
position
;
return
_
.
isEqual
(
refs
,
diffPositionCopy
)
||
_
.
isEqual
(
originalRefs
,
diffPositionCopy
);
}
return
latestDiff
&&
discussion
.
active
&&
lineCode
===
discussion
.
line_code
;
// eslint-disable-next-line
return
latestDiff
&&
discussion
.
active
&&
line_code
===
discussion
.
line_code
;
}
export
const
generateTreeList
=
files
=>
files
.
reduce
(
(
acc
,
file
)
=>
{
const
{
fileHash
,
addedLines
,
removedLines
,
newFile
,
deletedFile
,
newPath
}
=
file
;
const
split
=
newPath
.
split
(
'
/
'
);
const
split
=
file
.
new_path
.
split
(
'
/
'
);
split
.
forEach
((
name
,
i
)
=>
{
const
parent
=
acc
.
treeEntries
[
split
.
slice
(
0
,
i
).
join
(
'
/
'
)];
const
path
=
`
${
parent
?
`
${
parent
.
path
}
/`
:
''
}${
name
}
`
;
if
(
!
acc
.
treeEntries
[
path
])
{
const
type
=
path
===
newP
ath
?
'
blob
'
:
'
tree
'
;
const
type
=
path
===
file
.
new_p
ath
?
'
blob
'
:
'
tree
'
;
acc
.
treeEntries
[
path
]
=
{
key
:
path
,
path
,
...
...
@@ -307,11 +299,11 @@ export const generateTreeList = files =>
if
(
type
===
'
blob
'
)
{
Object
.
assign
(
entry
,
{
changed
:
true
,
tempFile
:
newF
ile
,
deleted
:
deletedF
ile
,
fileHash
,
addedLines
,
removedLines
,
tempFile
:
file
.
new_f
ile
,
deleted
:
file
.
deleted_f
ile
,
fileHash
:
file
.
file_hash
,
addedLines
:
file
.
added_lines
,
removedLines
:
file
.
removed_lines
,
});
}
else
{
Object
.
assign
(
entry
,
{
...
...
@@ -329,6 +321,6 @@ export const generateTreeList = files =>
);
export
const
getDiffMode
=
diffFile
=>
{
const
diffModeKey
=
Object
.
keys
(
diffModes
).
find
(
key
=>
diffFile
[
`
${
key
}
F
ile`
]);
const
diffModeKey
=
Object
.
keys
(
diffModes
).
find
(
key
=>
diffFile
[
`
${
key
}
_f
ile`
]);
return
diffModes
[
diffModeKey
]
||
diffModes
.
replaced
;
};
app/assets/javascripts/notes/components/diff_with_note.vue
View file @
290f8281
<
script
>
import
{
mapState
,
mapActions
}
from
'
vuex
'
;
import
{
convertObjectPropsToCamelCase
}
from
'
~/lib/utils/common_utils
'
;
import
DiffFileHeader
from
'
~/diffs/components/diff_file_header.vue
'
;
import
DiffViewer
from
'
~/vue_shared/components/diff_viewer/diff_viewer.vue
'
;
import
ImageDiffOverlay
from
'
~/diffs/components/image_diff_overlay.vue
'
;
...
...
@@ -34,7 +33,9 @@ export default {
return
getDiffMode
(
this
.
diffFile
);
},
hasTruncatedDiffLines
()
{
return
this
.
discussion
.
truncatedDiffLines
&&
this
.
discussion
.
truncatedDiffLines
.
length
!==
0
;
return
(
this
.
discussion
.
truncated_diff_lines
&&
this
.
discussion
.
truncated_diff_lines
.
length
!==
0
);
},
isDiscussionsExpanded
()
{
return
true
;
// TODO: @fatihacet - Fix this.
...
...
@@ -50,19 +51,17 @@ export default {
return
text
?
'
text-file
'
:
'
js-image-file
'
;
},
diffFile
()
{
return
convertObjectPropsToCamelCase
(
this
.
discussion
.
diffFile
,
{
deep
:
true
})
;
return
this
.
discussion
.
diff_file
;
},
imageDiffHtml
()
{
return
this
.
discussion
.
image
DiffH
tml
;
return
this
.
discussion
.
image
_diff_h
tml
;
},
userColorScheme
()
{
return
window
.
gon
.
user_color_scheme
;
},
normalizedDiffLines
()
{
if
(
this
.
discussion
.
truncatedDiffLines
)
{
return
this
.
discussion
.
truncatedDiffLines
.
map
(
line
=>
trimFirstCharOfLineContent
(
convertObjectPropsToCamelCase
(
line
)),
);
if
(
this
.
discussion
.
truncated_diff_lines
)
{
return
this
.
discussion
.
truncated_diff_lines
.
map
(
line
=>
trimFirstCharOfLineContent
(
line
));
}
return
[];
...
...
@@ -97,7 +96,7 @@ export default {
class=
"diff-file file-holder"
>
<diff-file-header
:discussion-path=
"discussion.discussion
P
ath"
:discussion-path=
"discussion.discussion
_p
ath"
:diff-file=
"diffFile"
:can-current-user-fork=
"false"
:discussions-expanded=
"isDiscussionsExpanded"
...
...
@@ -111,15 +110,15 @@ export default {
<table>
<tr
v-for=
"line in normalizedDiffLines"
:key=
"line.line
C
ode"
:key=
"line.line
_c
ode"
class=
"line_holder"
>
<td
class=
"diff-line-num old_line"
>
{{
line
.
old
L
ine
}}
</td>
<td
class=
"diff-line-num new_line"
>
{{
line
.
new
L
ine
}}
</td>
<td
class=
"diff-line-num old_line"
>
{{
line
.
old
_l
ine
}}
</td>
<td
class=
"diff-line-num new_line"
>
{{
line
.
new
_l
ine
}}
</td>
<td
:class=
"line.type"
class=
"line_content"
v-html=
"line.rich
T
ext"
v-html=
"line.rich
_t
ext"
>
</td>
</tr>
...
...
@@ -165,17 +164,17 @@ export default {
>
<diff-viewer
:diff-mode=
"diffMode"
:new-path=
"diffFile.new
P
ath"
:new-sha=
"diffFile.diff
Refs.headS
ha"
:old-path=
"diffFile.old
P
ath"
:old-sha=
"diffFile.diff
Refs.baseS
ha"
:file-hash=
"diffFile.file
H
ash"
:new-path=
"diffFile.new
_p
ath"
:new-sha=
"diffFile.diff
_refs.head_s
ha"
:old-path=
"diffFile.old
_p
ath"
:old-sha=
"diffFile.diff
_refs.base_s
ha"
:file-hash=
"diffFile.file
_h
ash"
:project-path=
"projectPath"
>
<image-diff-overlay
slot=
"image-overlay"
:discussions=
"discussion"
:file-hash=
"diffFile.file
H
ash"
:file-hash=
"diffFile.file
_h
ash"
:show-comment-icon=
"true"
:should-toggle-discussion=
"false"
badge-class=
"image-comment-badge"
...
...
app/assets/javascripts/notes/components/noteable_discussion.vue
View file @
290f8281
<
script
>
import
{
mapActions
,
mapGetters
}
from
'
vuex
'
;
import
{
convertObjectPropsToCamelCase
}
from
'
~/lib/utils/common_utils
'
;
import
{
truncateSha
}
from
'
~/lib/utils/text_utility
'
;
import
{
s__
}
from
'
~/locale
'
;
import
systemNote
from
'
~/vue_shared/components/notes/system_note.vue
'
;
...
...
@@ -98,17 +97,16 @@ export default {
transformedDiscussion
()
{
return
{
...
this
.
discussion
.
notes
[
0
],
truncatedDiffLines
:
this
.
discussion
.
truncated_diff_lines
||
[],
truncatedDiffLinesPath
:
this
.
discussion
.
truncated_diff_lines_path
,
diffFile
:
this
.
discussion
.
diff_file
,
diffDiscussion
:
this
.
discussion
.
diff_discussion
,
imageDiffHtml
:
this
.
discussion
.
image_diff_html
,
truncated_diff_lines
:
this
.
discussion
.
truncated_diff_lines
||
[],
truncated_diff_lines_path
:
this
.
discussion
.
truncated_diff_lines_path
,
diff_file
:
this
.
discussion
.
diff_file
,
diff_discussion
:
this
.
discussion
.
diff_discussion
,
active
:
this
.
discussion
.
active
,
discussion
P
ath
:
this
.
discussion
.
discussion_path
,
discussion
_p
ath
:
this
.
discussion
.
discussion_path
,
resolved
:
this
.
discussion
.
resolved
,
resolved
B
y
:
this
.
discussion
.
resolved_by
,
resolved
ByP
ush
:
this
.
discussion
.
resolved_by_push
,
resolved
A
t
:
this
.
discussion
.
resolved_at
,
resolved
_b
y
:
this
.
discussion
.
resolved_by
,
resolved
_by_p
ush
:
this
.
discussion
.
resolved_by_push
,
resolved
_a
t
:
this
.
discussion
.
resolved_at
,
};
},
author
()
{
...
...
@@ -148,7 +146,7 @@ export default {
return
null
;
},
resolvedText
()
{
return
this
.
transformedDiscussion
.
resolved
ByP
ush
?
'
Automatically resolved
'
:
'
Resolved
'
;
return
this
.
transformedDiscussion
.
resolved
_by_p
ush
?
'
Automatically resolved
'
:
'
Resolved
'
;
},
hasMultipleUnresolvedDiscussions
()
{
return
this
.
unresolvedDiscussions
.
length
>
1
;
...
...
@@ -160,12 +158,14 @@ export default {
);
},
shouldRenderDiffs
()
{
const
{
diffDiscussion
,
diffFile
}
=
this
.
transformedDiscussion
;
return
diffDiscussion
&&
diffFile
&&
this
.
renderDiffFile
;
return
(
this
.
transformedDiscussion
.
diff_discussion
&&
this
.
transformedDiscussion
.
diff_file
&&
this
.
renderDiffFile
);
},
shouldGroupReplies
()
{
return
!
this
.
shouldRenderDiffs
&&
!
this
.
transformedDiscussion
.
diff
D
iscussion
;
return
!
this
.
shouldRenderDiffs
&&
!
this
.
transformedDiscussion
.
diff
_d
iscussion
;
},
shouldRenderHeader
()
{
return
this
.
shouldRenderDiffs
;
...
...
@@ -175,7 +175,7 @@ export default {
},
wrapperComponentProps
()
{
if
(
this
.
shouldRenderDiffs
)
{
return
{
discussion
:
convertObjectPropsToCamelCase
(
this
.
discussion
)
};
return
{
discussion
:
this
.
discussion
};
}
return
{};
...
...
@@ -194,8 +194,8 @@ export default {
},
shouldShowDiscussions
()
{
const
isExpanded
=
this
.
discussion
.
expanded
;
const
{
diffDiscussion
,
resolved
}
=
this
.
transformedDiscussion
;
const
isResolvedNonDiffDiscussion
=
!
diffD
iscussion
&&
resolved
;
const
{
resolved
}
=
this
.
transformedDiscussion
;
const
isResolvedNonDiffDiscussion
=
!
this
.
transformedDiscussion
.
diff_d
iscussion
&&
resolved
;
return
isExpanded
||
this
.
alwaysExpanded
||
isResolvedNonDiffDiscussion
;
},
...
...
@@ -343,9 +343,9 @@ Please check your network connection and try again.`;
:expanded=
"discussion.expanded"
@
toggleHandler=
"toggleDiscussionHandler"
>
<template
v-if=
"transformedDiscussion.diff
D
iscussion"
>
<template
v-if=
"transformedDiscussion.diff
_d
iscussion"
>
started a discussion on
<a
:href=
"transformedDiscussion.discussion
P
ath"
>
<a
:href=
"transformedDiscussion.discussion
_p
ath"
>
<template
v-if=
"transformedDiscussion.active"
>
the diff
</
template
>
...
...
@@ -366,8 +366,8 @@ Please check your network connection and try again.`;
</note-header>
<note-edited-text
v-if=
"transformedDiscussion.resolved"
:edited-at=
"transformedDiscussion.resolved
A
t"
:edited-by=
"transformedDiscussion.resolved
B
y"
:edited-at=
"transformedDiscussion.resolved
_a
t"
:edited-by=
"transformedDiscussion.resolved
_b
y"
:action-text=
"resolvedText"
class-name=
"discussion-headline-light js-discussion-headline"
/>
...
...
app/assets/javascripts/notes/stores/actions.js
View file @
290f8281
...
...
@@ -341,7 +341,7 @@ export const scrollToNoteIfNeeded = (context, el) => {
};
export
const
fetchDiscussionDiffLines
=
({
commit
},
discussion
)
=>
axios
.
get
(
discussion
.
truncated
DiffLinesP
ath
).
then
(({
data
})
=>
{
axios
.
get
(
discussion
.
truncated
_diff_lines_p
ath
).
then
(({
data
})
=>
{
commit
(
types
.
SET_DISCUSSION_DIFF_LINES
,
{
discussionId
:
discussion
.
id
,
diffLines
:
data
.
truncated_diff_lines
,
...
...
app/assets/javascripts/notes/stores/mutations.js
View file @
290f8281
...
...
@@ -102,7 +102,7 @@ export default {
discussionsData
.
forEach
(
discussion
=>
{
if
(
discussion
.
diff_file
)
{
Object
.
assign
(
discussion
,
{
file
H
ash
:
discussion
.
diff_file
.
file_hash
,
file
_h
ash
:
discussion
.
diff_file
.
file_hash
,
truncated_diff_lines
:
discussion
.
truncated_diff_lines
||
[],
});
}
...
...
@@ -195,7 +195,7 @@ export default {
const
selectedDiscussion
=
state
.
discussions
.
find
(
disc
=>
disc
.
id
===
note
.
id
);
note
.
expanded
=
true
;
// override expand flag to prevent collapse
if
(
note
.
diff_file
)
{
Object
.
assign
(
note
,
{
file
H
ash
:
note
.
diff_file
.
file_hash
});
Object
.
assign
(
note
,
{
file
_h
ash
:
note
.
diff_file
.
file_hash
});
}
Object
.
assign
(
selectedDiscussion
,
{
...
note
});
},
...
...
app/assets/stylesheets/pages/notes.scss
View file @
290f8281
...
...
@@ -272,7 +272,7 @@ $note-form-margin-left: 72px;
}
.system-note
{
padding
:
6px
2
0
px
;
padding
:
6px
2
1
px
;
margin
:
$gl-padding-24
0
;
background-color
:
transparent
;
...
...
@@ -407,6 +407,24 @@ $note-form-margin-left: 72px;
}
}
.tab-pane.notes
{
.diff-file
.notes
.system-note
{
margin
:
0
;
}
}
.tab-pane.diffs
{
.system-note
{
padding
:
0
$gl-padding
;
margin-left
:
20px
;
}
.notes
>
.note-discussion
li
.note.system-note
{
border-bottom
:
0
;
padding
:
0
$gl-padding
;
}
}
.diff-file
{
.is-over
{
.add-diff-note
{
...
...
@@ -426,7 +444,7 @@ $note-form-margin-left: 72px;
}
.system-note
{
margin
:
0
;
background-color
:
$white-light
;
padding
:
$gl-padding
;
}
}
...
...
@@ -485,6 +503,11 @@ $note-form-margin-left: 72px;
.note-wrapper
{
@include
outline-comment
();
&
.system-note
{
border
:
0
;
margin-left
:
20px
;
}
}
.discussion-reply-holder
{
...
...
doc/workflow/shortcuts.md
View file @
290f8281
...
...
@@ -101,4 +101,4 @@ You can see GitLab's keyboard shortcuts by using 'shift + ?'
| Keyboard Shortcut | Description |
| ----------------- | ----------- |
|
<kbd>
⌘
</kbd>
+
<kbd>
p
</kbd>
| Go to file |
|
<kbd>
Cmd
</kbd>
/
<kbd>
Ctrl
</kbd>
+
<kbd>
p
</kbd>
| Go to file |
spec/javascripts/diffs/components/commit_item_spec.js
View file @
290f8281
...
...
@@ -21,7 +21,7 @@ const getAvatarElement = vm => vm.$el.querySelector('.user-avatar-link');
const
getCommitterElement
=
vm
=>
vm
.
$el
.
querySelector
(
'
.commiter
'
);
const
getCommitActionsElement
=
vm
=>
vm
.
$el
.
querySelector
(
'
.commit-actions
'
);
describe
(
'
diffs/components/commit_
widget
'
,
()
=>
{
describe
(
'
diffs/components/commit_
item
'
,
()
=>
{
const
Component
=
Vue
.
extend
(
CommitItem
);
const
timeago
=
getTimeago
();
const
{
commit
}
=
getDiffWithCommit
();
...
...
@@ -37,15 +37,15 @@ describe('diffs/components/commit_widget', () => {
it
(
'
renders commit title
'
,
()
=>
{
const
titleElement
=
getTitleElement
(
vm
);
expect
(
titleElement
).
toHaveAttr
(
'
href
'
,
commit
.
commit
U
rl
);
expect
(
titleElement
).
toHaveText
(
commit
.
title
H
tml
);
expect
(
titleElement
).
toHaveAttr
(
'
href
'
,
commit
.
commit
_u
rl
);
expect
(
titleElement
).
toHaveText
(
commit
.
title
_h
tml
);
});
it
(
'
renders commit description
'
,
()
=>
{
const
descElement
=
getDescElement
(
vm
);
const
descExpandElement
=
getDescExpandElement
(
vm
);
const
expected
=
commit
.
description
H
tml
.
replace
(
/
/g
,
''
);
const
expected
=
commit
.
description
_h
tml
.
replace
(
/
/g
,
''
);
expect
(
trimText
(
descElement
.
innerHTML
)).
toEqual
(
trimText
(
expected
));
expect
(
descExpandElement
).
not
.
toBeNull
();
...
...
@@ -56,7 +56,7 @@ describe('diffs/components/commit_widget', () => {
const
labelElement
=
shaElement
.
querySelector
(
'
.label
'
);
const
buttonElement
=
shaElement
.
querySelector
(
'
button
'
);
expect
(
labelElement
.
textContent
).
toEqual
(
commit
.
short
I
d
);
expect
(
labelElement
.
textContent
).
toEqual
(
commit
.
short
_i
d
);
expect
(
buttonElement
).
toHaveData
(
'
clipboard-text
'
,
commit
.
id
);
});
...
...
@@ -64,27 +64,27 @@ describe('diffs/components/commit_widget', () => {
const
avatarElement
=
getAvatarElement
(
vm
);
const
imgElement
=
avatarElement
.
querySelector
(
'
img
'
);
expect
(
avatarElement
).
toHaveAttr
(
'
href
'
,
commit
.
author
.
web
U
rl
);
expect
(
avatarElement
).
toHaveAttr
(
'
href
'
,
commit
.
author
.
web
_u
rl
);
expect
(
imgElement
).
toHaveClass
(
'
s36
'
);
expect
(
imgElement
).
toHaveAttr
(
'
alt
'
,
commit
.
author
.
name
);
expect
(
imgElement
).
toHaveAttr
(
'
src
'
,
commit
.
author
.
avatar
U
rl
);
expect
(
imgElement
).
toHaveAttr
(
'
src
'
,
commit
.
author
.
avatar
_u
rl
);
});
it
(
'
renders committer text
'
,
()
=>
{
const
committerElement
=
getCommitterElement
(
vm
);
const
nameElement
=
committerElement
.
querySelector
(
'
a
'
);
const
expectTimeText
=
timeago
.
format
(
commit
.
authored
D
ate
);
const
expectTimeText
=
timeago
.
format
(
commit
.
authored
_d
ate
);
const
expectedText
=
`
${
commit
.
author
.
name
}
authored
${
expectTimeText
}
`
;
expect
(
trimText
(
committerElement
.
textContent
)).
toEqual
(
expectedText
);
expect
(
nameElement
).
toHaveAttr
(
'
href
'
,
commit
.
author
.
web
U
rl
);
expect
(
nameElement
).
toHaveAttr
(
'
href
'
,
commit
.
author
.
web
_u
rl
);
expect
(
nameElement
).
toHaveText
(
commit
.
author
.
name
);
});
describe
(
'
without commit description
'
,
()
=>
{
beforeEach
(
done
=>
{
vm
.
commit
.
description
H
tml
=
''
;
vm
.
commit
.
description
_h
tml
=
''
;
vm
.
$nextTick
()
.
then
(
done
)
...
...
@@ -103,9 +103,9 @@ describe('diffs/components/commit_widget', () => {
describe
(
'
with no matching user
'
,
()
=>
{
beforeEach
(
done
=>
{
vm
.
commit
.
author
=
null
;
vm
.
commit
.
author
E
mail
=
TEST_AUTHOR_EMAIL
;
vm
.
commit
.
author
N
ame
=
TEST_AUTHOR_NAME
;
vm
.
commit
.
author
GravatarU
rl
=
TEST_AUTHOR_GRAVATAR
;
vm
.
commit
.
author
_e
mail
=
TEST_AUTHOR_EMAIL
;
vm
.
commit
.
author
_n
ame
=
TEST_AUTHOR_NAME
;
vm
.
commit
.
author
_gravatar_u
rl
=
TEST_AUTHOR_GRAVATAR
;
vm
.
$nextTick
()
.
then
(
done
)
...
...
@@ -132,7 +132,7 @@ describe('diffs/components/commit_widget', () => {
describe
(
'
with signature
'
,
()
=>
{
beforeEach
(
done
=>
{
vm
.
commit
.
signature
H
tml
=
TEST_SIGNATURE_HTML
;
vm
.
commit
.
signature
_h
tml
=
TEST_SIGNATURE_HTML
;
vm
.
$nextTick
()
.
then
(
done
)
...
...
@@ -148,7 +148,7 @@ describe('diffs/components/commit_widget', () => {
describe
(
'
with pipeline status
'
,
()
=>
{
beforeEach
(
done
=>
{
vm
.
commit
.
pipeline
StatusP
ath
=
TEST_PIPELINE_STATUS_PATH
;
vm
.
commit
.
pipeline
_status_p
ath
=
TEST_PIPELINE_STATUS_PATH
;
vm
.
$nextTick
()
.
then
(
done
)
...
...
spec/javascripts/diffs/components/commit_widget_spec.js
View file @
290f8281
...
...
@@ -19,6 +19,6 @@ describe('diffs/components/commit_widget', () => {
const
commitElement
=
vm
.
$el
.
querySelector
(
'
li.commit
'
);
expect
(
commitElement
).
not
.
toBeNull
();
expect
(
commitElement
).
toContainText
(
commit
.
short
I
d
);
expect
(
commitElement
).
toContainText
(
commit
.
short
_i
d
);
});
});
spec/javascripts/diffs/components/diff_content_spec.js
View file @
290f8281
...
...
@@ -56,14 +56,14 @@ describe('DiffContent', () => {
describe
(
'
image diff
'
,
()
=>
{
beforeEach
(
done
=>
{
vm
.
diffFile
.
new
P
ath
=
GREEN_BOX_IMAGE_URL
;
vm
.
diffFile
.
new
S
ha
=
'
DEF
'
;
vm
.
diffFile
.
old
P
ath
=
RED_BOX_IMAGE_URL
;
vm
.
diffFile
.
old
S
ha
=
'
ABC
'
;
vm
.
diffFile
.
view
P
ath
=
''
;
vm
.
diffFile
.
new
_p
ath
=
GREEN_BOX_IMAGE_URL
;
vm
.
diffFile
.
new
_s
ha
=
'
DEF
'
;
vm
.
diffFile
.
old
_p
ath
=
RED_BOX_IMAGE_URL
;
vm
.
diffFile
.
old
_s
ha
=
'
ABC
'
;
vm
.
diffFile
.
view
_p
ath
=
''
;
vm
.
diffFile
.
discussions
=
[{
...
discussionsMockData
}];
vm
.
$store
.
state
.
diffs
.
commentForms
.
push
({
fileHash
:
vm
.
diffFile
.
file
H
ash
,
fileHash
:
vm
.
diffFile
.
file
_h
ash
,
x
:
10
,
y
:
20
,
width
:
100
,
...
...
@@ -113,10 +113,10 @@ describe('DiffContent', () => {
describe
(
'
file diff
'
,
()
=>
{
it
(
'
should have download buttons in place
'
,
done
=>
{
const
el
=
vm
.
$el
;
vm
.
diffFile
.
new
P
ath
=
'
test.abc
'
;
vm
.
diffFile
.
new
S
ha
=
'
DEF
'
;
vm
.
diffFile
.
old
P
ath
=
'
test.abc
'
;
vm
.
diffFile
.
old
S
ha
=
'
ABC
'
;
vm
.
diffFile
.
new
_p
ath
=
'
test.abc
'
;
vm
.
diffFile
.
new
_s
ha
=
'
DEF
'
;
vm
.
diffFile
.
old
_p
ath
=
'
test.abc
'
;
vm
.
diffFile
.
old
_s
ha
=
'
ABC
'
;
vm
.
$nextTick
(()
=>
{
expect
(
el
.
querySelectorAll
(
'
.js-diff-inline-view
'
).
length
).
toEqual
(
0
);
...
...
spec/javascripts/diffs/components/diff_file_header_spec.js
View file @
290f8281
...
...
@@ -3,7 +3,6 @@ import Vuex from 'vuex';
import
diffsModule
from
'
~/diffs/store/modules
'
;
import
notesModule
from
'
~/notes/stores/modules
'
;
import
DiffFileHeader
from
'
~/diffs/components/diff_file_header.vue
'
;
import
{
convertObjectPropsToCamelCase
}
from
'
~/lib/utils/common_utils
'
;
import
{
mountComponentWithStore
}
from
'
spec/helpers/vue_mount_component_helper
'
;
Vue
.
use
(
Vuex
);
...
...
@@ -24,9 +23,9 @@ describe('diff_file_header', () => {
});
beforeEach
(()
=>
{
const
diffFile
=
convertObjectPropsToCamelCase
(
diffDiscussionMock
.
diff_file
,
{
deep
:
true
})
;
const
diffFile
=
diffDiscussionMock
.
diff_file
;
props
=
{
diffFile
,
diffFile
:
{
...
diffFile
}
,
canCurrentUserFork
:
false
,
};
});
...
...
@@ -62,8 +61,8 @@ describe('diff_file_header', () => {
beforeEach
(()
=>
{
props
.
discussionPath
=
'
link://to/discussion
'
;
Object
.
assign
(
props
.
diffFile
,
{
submodule
L
ink
:
'
link://to/submodule
'
,
submodule
TreeU
rl
:
'
some://tree/url
'
,
submodule
_l
ink
:
'
link://to/submodule
'
,
submodule
_tree_u
rl
:
'
some://tree/url
'
,
});
});
...
...
@@ -80,18 +79,18 @@ describe('diff_file_header', () => {
vm
=
mountComponentWithStore
(
Component
,
{
props
,
store
});
expect
(
vm
.
titleLink
).
toBe
(
props
.
diffFile
.
submodule
TreeU
rl
);
expect
(
vm
.
titleLink
).
toBe
(
props
.
diffFile
.
submodule
_tree_u
rl
);
});
it
(
'
returns the submoduleLink for submodules without submoduleTreeUrl
'
,
()
=>
{
Object
.
assign
(
props
.
diffFile
,
{
submodule
:
true
,
submodule
TreeU
rl
:
null
,
submodule
_tree_u
rl
:
null
,
});
vm
=
mountComponentWithStore
(
Component
,
{
props
,
store
});
expect
(
vm
.
titleLink
).
toBe
(
props
.
diffFile
.
submodule
L
ink
);
expect
(
vm
.
titleLink
).
toBe
(
props
.
diffFile
.
submodule
_l
ink
);
});
it
(
'
sets the correct path to the discussion
'
,
()
=>
{
...
...
@@ -107,7 +106,7 @@ describe('diff_file_header', () => {
beforeEach
(()
=>
{
Object
.
assign
(
props
.
diffFile
,
{
blob
:
{
id
:
'
b10b1db10b1d
'
},
file
P
ath
:
'
path/to/file
'
,
file
_p
ath
:
'
path/to/file
'
,
});
});
...
...
@@ -116,7 +115,7 @@ describe('diff_file_header', () => {
vm
=
mountComponentWithStore
(
Component
,
{
props
,
store
});
expect
(
vm
.
filePath
).
toBe
(
props
.
diffFile
.
file
P
ath
);
expect
(
vm
.
filePath
).
toBe
(
props
.
diffFile
.
file
_p
ath
);
});
it
(
'
appends the truncated blob id for submodules
'
,
()
=>
{
...
...
@@ -125,14 +124,14 @@ describe('diff_file_header', () => {
vm
=
mountComponentWithStore
(
Component
,
{
props
,
store
});
expect
(
vm
.
filePath
).
toBe
(
`
${
props
.
diffFile
.
file
P
ath
}
@
${
props
.
diffFile
.
blob
.
id
.
substr
(
0
,
8
)}
`
,
`
${
props
.
diffFile
.
file
_p
ath
}
@
${
props
.
diffFile
.
blob
.
id
.
substr
(
0
,
8
)}
`
,
);
});
});
describe
(
'
titleTag
'
,
()
=>
{
it
(
'
returns a link tag if fileHash is set
'
,
()
=>
{
props
.
diffFile
.
file
H
ash
=
'
some hash
'
;
props
.
diffFile
.
file
_h
ash
=
'
some hash
'
;
vm
=
mountComponentWithStore
(
Component
,
{
props
,
store
});
...
...
@@ -140,7 +139,7 @@ describe('diff_file_header', () => {
});
it
(
'
returns a span tag if fileHash is not set
'
,
()
=>
{
props
.
diffFile
.
file
H
ash
=
null
;
props
.
diffFile
.
file
_h
ash
=
null
;
vm
=
mountComponentWithStore
(
Component
,
{
props
,
store
});
...
...
@@ -151,8 +150,8 @@ describe('diff_file_header', () => {
describe
(
'
isUsingLfs
'
,
()
=>
{
beforeEach
(()
=>
{
Object
.
assign
(
props
.
diffFile
,
{
stored
E
xternally
:
true
,
external
S
torage
:
'
lfs
'
,
stored
_e
xternally
:
true
,
external
_s
torage
:
'
lfs
'
,
});
});
...
...
@@ -163,7 +162,7 @@ describe('diff_file_header', () => {
});
it
(
'
returns false if file is not stored externally
'
,
()
=>
{
props
.
diffFile
.
stored
E
xternally
=
false
;
props
.
diffFile
.
stored
_e
xternally
=
false
;
vm
=
mountComponentWithStore
(
Component
,
{
props
,
store
});
...
...
@@ -171,7 +170,7 @@ describe('diff_file_header', () => {
});
it
(
'
returns false if file is not stored in LFS
'
,
()
=>
{
props
.
diffFile
.
external
S
torage
=
'
not lfs
'
;
props
.
diffFile
.
external
_s
torage
=
'
not lfs
'
;
vm
=
mountComponentWithStore
(
Component
,
{
props
,
store
});
...
...
@@ -200,7 +199,7 @@ describe('diff_file_header', () => {
describe
(
'
viewFileButtonText
'
,
()
=>
{
it
(
'
contains the truncated content SHA
'
,
()
=>
{
const
dummySha
=
'
deebd00f is no SHA
'
;
props
.
diffFile
.
content
S
ha
=
dummySha
;
props
.
diffFile
.
content
_s
ha
=
dummySha
;
vm
=
mountComponentWithStore
(
Component
,
{
props
,
store
});
...
...
@@ -212,7 +211,7 @@ describe('diff_file_header', () => {
describe
(
'
viewReplacedFileButtonText
'
,
()
=>
{
it
(
'
contains the truncated base SHA
'
,
()
=>
{
const
dummySha
=
'
deadabba sings no more
'
;
props
.
diffFile
.
diff
Refs
.
baseS
ha
=
dummySha
;
props
.
diffFile
.
diff
_refs
.
base_s
ha
=
dummySha
;
vm
=
mountComponentWithStore
(
Component
,
{
props
,
store
});
...
...
@@ -281,32 +280,32 @@ describe('diff_file_header', () => {
const
filePaths
=
()
=>
vm
.
$el
.
querySelectorAll
(
'
.file-title-name
'
);
it
(
'
displays the path of a added file
'
,
()
=>
{
props
.
diffFile
.
renamed
F
ile
=
false
;
props
.
diffFile
.
renamed
_f
ile
=
false
;
vm
=
mountComponentWithStore
(
Component
,
{
props
,
store
});
expect
(
filePaths
()).
toHaveLength
(
1
);
expect
(
filePaths
()[
0
]).
toHaveText
(
props
.
diffFile
.
file
P
ath
);
expect
(
filePaths
()[
0
]).
toHaveText
(
props
.
diffFile
.
file
_p
ath
);
});
it
(
'
displays path for deleted file
'
,
()
=>
{
props
.
diffFile
.
renamed
F
ile
=
false
;
props
.
diffFile
.
deleted
F
ile
=
true
;
props
.
diffFile
.
renamed
_f
ile
=
false
;
props
.
diffFile
.
deleted
_f
ile
=
true
;
vm
=
mountComponentWithStore
(
Component
,
{
props
,
store
});
expect
(
filePaths
()).
toHaveLength
(
1
);
expect
(
filePaths
()[
0
]).
toHaveText
(
`
${
props
.
diffFile
.
file
P
ath
}
deleted`
);
expect
(
filePaths
()[
0
]).
toHaveText
(
`
${
props
.
diffFile
.
file
_p
ath
}
deleted`
);
});
it
(
'
displays old and new path if the file was renamed
'
,
()
=>
{
props
.
diffFile
.
renamed
F
ile
=
true
;
props
.
diffFile
.
renamed
_f
ile
=
true
;
vm
=
mountComponentWithStore
(
Component
,
{
props
,
store
});
expect
(
filePaths
()).
toHaveLength
(
2
);
expect
(
filePaths
()[
0
]).
toHaveText
(
props
.
diffFile
.
old
P
ath
);
expect
(
filePaths
()[
1
]).
toHaveText
(
props
.
diffFile
.
new
P
ath
);
expect
(
filePaths
()[
0
]).
toHaveText
(
props
.
diffFile
.
old
_p
ath
);
expect
(
filePaths
()[
1
]).
toHaveText
(
props
.
diffFile
.
new
_p
ath
);
});
});
...
...
@@ -323,19 +322,19 @@ describe('diff_file_header', () => {
describe
(
'
file mode
'
,
()
=>
{
it
(
'
it displays old and new file mode if it changed
'
,
()
=>
{
props
.
diffFile
.
mode
C
hanged
=
true
;
props
.
diffFile
.
mode
_c
hanged
=
true
;
vm
=
mountComponentWithStore
(
Component
,
{
props
,
store
});
const
{
fileMode
}
=
vm
.
$refs
;
expect
(
fileMode
).
not
.
toBe
(
undefined
);
expect
(
fileMode
).
toContainText
(
props
.
diffFile
.
a
M
ode
);
expect
(
fileMode
).
toContainText
(
props
.
diffFile
.
b
M
ode
);
expect
(
fileMode
).
toContainText
(
props
.
diffFile
.
a
_m
ode
);
expect
(
fileMode
).
toContainText
(
props
.
diffFile
.
b
_m
ode
);
});
it
(
'
does not display the file mode if it has not changed
'
,
()
=>
{
props
.
diffFile
.
mode
C
hanged
=
false
;
props
.
diffFile
.
mode
_c
hanged
=
false
;
vm
=
mountComponentWithStore
(
Component
,
{
props
,
store
});
...
...
@@ -350,8 +349,8 @@ describe('diff_file_header', () => {
it
(
'
displays the LFS label for files stored in LFS
'
,
()
=>
{
Object
.
assign
(
props
.
diffFile
,
{
stored
E
xternally
:
true
,
external
S
torage
:
'
lfs
'
,
stored
_e
xternally
:
true
,
external
_s
torage
:
'
lfs
'
,
});
vm
=
mountComponentWithStore
(
Component
,
{
props
,
store
});
...
...
@@ -361,7 +360,7 @@ describe('diff_file_header', () => {
});
it
(
'
does not display the LFS label for files stored in repository
'
,
()
=>
{
props
.
diffFile
.
stored
E
xternally
=
false
;
props
.
diffFile
.
stored
_e
xternally
=
false
;
vm
=
mountComponentWithStore
(
Component
,
{
props
,
store
});
...
...
@@ -378,7 +377,7 @@ describe('diff_file_header', () => {
it
(
'
should show edit button when file is editable
'
,
()
=>
{
props
.
addMergeRequestButtons
=
true
;
props
.
diffFile
.
edit
P
ath
=
'
/
'
;
props
.
diffFile
.
edit
_p
ath
=
'
/
'
;
vm
=
mountComponentWithStore
(
Component
,
{
props
,
store
});
expect
(
vm
.
$el
.
querySelector
(
'
.js-edit-blob
'
)).
toContainText
(
'
Edit
'
);
...
...
@@ -386,8 +385,8 @@ describe('diff_file_header', () => {
it
(
'
should not show edit button when file is deleted
'
,
()
=>
{
props
.
addMergeRequestButtons
=
true
;
props
.
diffFile
.
deleted
F
ile
=
true
;
props
.
diffFile
.
edit
P
ath
=
'
/
'
;
props
.
diffFile
.
deleted
_f
ile
=
true
;
props
.
diffFile
.
edit
_p
ath
=
'
/
'
;
vm
=
mountComponentWithStore
(
Component
,
{
props
,
store
});
expect
(
vm
.
$el
.
querySelector
(
'
.js-edit-blob
'
)).
toEqual
(
null
);
...
...
@@ -397,7 +396,7 @@ describe('diff_file_header', () => {
describe
(
'
addMergeRequestButtons
'
,
()
=>
{
beforeEach
(()
=>
{
props
.
addMergeRequestButtons
=
true
;
props
.
diffFile
.
edit
P
ath
=
''
;
props
.
diffFile
.
edit
_p
ath
=
''
;
});
describe
(
'
view on environment button
'
,
()
=>
{
...
...
@@ -405,8 +404,8 @@ describe('diff_file_header', () => {
const
title
=
'
url.title
'
;
it
(
'
displays link to external url
'
,
()
=>
{
props
.
diffFile
.
external
U
rl
=
url
;
props
.
diffFile
.
formatted
ExternalU
rl
=
title
;
props
.
diffFile
.
external
_u
rl
=
url
;
props
.
diffFile
.
formatted
_external_u
rl
=
title
;
vm
=
mountComponentWithStore
(
Component
,
{
props
,
store
});
...
...
@@ -415,8 +414,8 @@ describe('diff_file_header', () => {
});
it
(
'
hides link if no external url
'
,
()
=>
{
props
.
diffFile
.
external
U
rl
=
''
;
props
.
diffFile
.
formattedExternal
U
rl
=
title
;
props
.
diffFile
.
external
_u
rl
=
''
;
props
.
diffFile
.
formattedExternal
_u
rl
=
title
;
vm
=
mountComponentWithStore
(
Component
,
{
props
,
store
});
...
...
@@ -434,11 +433,11 @@ describe('diff_file_header', () => {
path
:
'
lib/base.js
'
,
name
:
'
base.js
'
,
mode
:
'
100644
'
,
readable
T
ext
:
true
,
readable
_t
ext
:
true
,
icon
:
'
file-text-o
'
,
};
propsCopy
.
addMergeRequestButtons
=
true
;
propsCopy
.
diffFile
.
deleted
F
ile
=
true
;
propsCopy
.
diffFile
.
deleted
_f
ile
=
true
;
vm
=
mountComponentWithStore
(
Component
,
{
props
:
propsCopy
,
...
...
@@ -459,11 +458,11 @@ describe('diff_file_header', () => {
path
:
'
lib/base.js
'
,
name
:
'
base.js
'
,
mode
:
'
100644
'
,
readable
T
ext
:
true
,
readable
_t
ext
:
true
,
icon
:
'
file-text-o
'
,
};
propsCopy
.
addMergeRequestButtons
=
true
;
propsCopy
.
diffFile
.
deleted
F
ile
=
true
;
propsCopy
.
diffFile
.
deleted
_f
ile
=
true
;
const
discussionGetter
=
()
=>
[
diffDiscussionMock
];
const
notesModuleMock
=
notesModule
();
...
...
spec/javascripts/diffs/components/diff_file_spec.js
View file @
290f8281
...
...
@@ -17,14 +17,14 @@ describe('DiffFile', () => {
describe
(
'
template
'
,
()
=>
{
it
(
'
should render component with file header, file content components
'
,
()
=>
{
const
el
=
vm
.
$el
;
const
{
file
Hash
,
fileP
ath
}
=
vm
.
file
;
const
{
file
_hash
,
file_p
ath
}
=
vm
.
file
;
expect
(
el
.
id
).
toEqual
(
file
H
ash
);
expect
(
el
.
id
).
toEqual
(
file
_h
ash
);
expect
(
el
.
classList
.
contains
(
'
diff-file
'
)).
toEqual
(
true
);
expect
(
el
.
querySelectorAll
(
'
.diff-content.hidden
'
).
length
).
toEqual
(
0
);
expect
(
el
.
querySelector
(
'
.js-file-title
'
)).
toBeDefined
();
expect
(
el
.
querySelector
(
'
.file-title-name
'
).
innerText
.
indexOf
(
file
P
ath
)).
toBeGreaterThan
(
-
1
);
expect
(
el
.
querySelector
(
'
.file-title-name
'
).
innerText
.
indexOf
(
file
_p
ath
)).
toBeGreaterThan
(
-
1
);
expect
(
el
.
querySelector
(
'
.js-syntax-highlight
'
)).
toBeDefined
();
expect
(
vm
.
file
.
renderIt
).
toEqual
(
false
);
...
...
@@ -52,7 +52,7 @@ describe('DiffFile', () => {
it
(
'
should have collapsed text and link
'
,
done
=>
{
vm
.
file
.
renderIt
=
true
;
vm
.
file
.
collapsed
=
false
;
vm
.
file
.
highlighted
DiffL
ines
=
null
;
vm
.
file
.
highlighted
_diff_l
ines
=
null
;
vm
.
$nextTick
(()
=>
{
expect
(
vm
.
$el
.
innerText
).
toContain
(
'
This diff is collapsed
'
);
...
...
@@ -90,8 +90,8 @@ describe('DiffFile', () => {
describe
(
'
too large diff
'
,
()
=>
{
it
(
'
should have too large warning and blob link
'
,
done
=>
{
const
BLOB_LINK
=
'
/file/view/path
'
;
vm
.
file
.
too
L
arge
=
true
;
vm
.
file
.
view
P
ath
=
BLOB_LINK
;
vm
.
file
.
too
_l
arge
=
true
;
vm
.
file
.
view
_p
ath
=
BLOB_LINK
;
vm
.
$nextTick
(()
=>
{
expect
(
vm
.
$el
.
innerText
).
toContain
(
...
...
@@ -112,8 +112,8 @@ describe('DiffFile', () => {
it
(
'
calls handleLoadCollapsedDiff if collapsed changed & file has no lines
'
,
done
=>
{
spyOn
(
vm
,
'
handleLoadCollapsedDiff
'
);
vm
.
file
.
highlighted
DiffL
ines
=
undefined
;
vm
.
file
.
parallel
DiffL
ines
=
[];
vm
.
file
.
highlighted
_diff_l
ines
=
undefined
;
vm
.
file
.
parallel
_diff_l
ines
=
[];
vm
.
file
.
collapsed
=
true
;
vm
.
$nextTick
()
...
...
spec/javascripts/diffs/components/diff_line_gutter_content_spec.js
View file @
290f8281
...
...
@@ -11,16 +11,16 @@ describe('DiffLineGutterContent', () => {
const
cmp
=
Vue
.
extend
(
DiffLineGutterContent
);
const
props
=
Object
.
assign
({},
options
);
props
.
line
=
{
line
C
ode
:
'
LC_42
'
,
line
_c
ode
:
'
LC_42
'
,
type
:
'
new
'
,
old
L
ine
:
null
,
new
L
ine
:
1
,
discussions
:
[],
old
_l
ine
:
null
,
new
_l
ine
:
1
,
discussions
:
[
{
...
discussionsMockData
}
],
text
:
'
+<span id="LC1" class="line" lang="plaintext"> - Bad dates</span>
\n
'
,
rich
T
ext
:
'
+<span id="LC1" class="line" lang="plaintext"> - Bad dates</span>
\n
'
,
meta
D
ata
:
null
,
rich
_t
ext
:
'
+<span id="LC1" class="line" lang="plaintext"> - Bad dates</span>
\n
'
,
meta
_d
ata
:
null
,
};
props
.
fileHash
=
getDiffFileMock
().
file
H
ash
;
props
.
fileHash
=
getDiffFileMock
().
file
_h
ash
;
props
.
contextLinesPath
=
'
/context/lines/path
'
;
return
createComponentWithStore
(
cmp
,
store
,
props
).
$mount
();
...
...
@@ -37,7 +37,7 @@ describe('DiffLineGutterContent', () => {
it
(
'
should return # if there is no lineCode
'
,
()
=>
{
const
component
=
createComponent
();
component
.
line
.
line
C
ode
=
''
;
component
.
line
.
line
_c
ode
=
''
;
expect
(
component
.
lineHref
).
toEqual
(
'
#
'
);
});
...
...
@@ -46,6 +46,7 @@ describe('DiffLineGutterContent', () => {
describe
(
'
discussions, hasDiscussions, shouldShowAvatarsOnGutter
'
,
()
=>
{
it
(
'
should return empty array when there is no discussion
'
,
()
=>
{
const
component
=
createComponent
();
component
.
line
.
discussions
=
[];
expect
(
component
.
hasDiscussions
).
toEqual
(
false
);
expect
(
component
.
shouldShowAvatarsOnGutter
).
toEqual
(
false
);
...
...
@@ -54,8 +55,8 @@ describe('DiffLineGutterContent', () => {
it
(
'
should return discussions for the given lineCode
'
,
()
=>
{
const
cmp
=
Vue
.
extend
(
DiffLineGutterContent
);
const
props
=
{
line
:
getDiffFileMock
().
highlighted
DiffL
ines
[
1
],
fileHash
:
getDiffFileMock
().
file
H
ash
,
line
:
getDiffFileMock
().
highlighted
_diff_l
ines
[
1
],
fileHash
:
getDiffFileMock
().
file
_h
ash
,
showCommentButton
:
true
,
contextLinesPath
:
'
/context/lines/path
'
,
};
...
...
@@ -104,10 +105,10 @@ describe('DiffLineGutterContent', () => {
it
(
'
should render user avatars
'
,
()
=>
{
const
component
=
createComponent
({
showCommentButton
:
true
,
lineCode
:
getDiffFileMock
().
highlighted
DiffLines
[
1
].
lineC
ode
,
lineCode
:
getDiffFileMock
().
highlighted
_diff_lines
[
1
].
line_c
ode
,
});
expect
(
component
.
$el
.
querySelector
(
'
.diff-comment-avatar-holders
'
)).
toBeDefined
(
);
expect
(
component
.
$el
.
querySelector
(
'
.diff-comment-avatar-holders
'
)).
not
.
toBe
(
null
);
});
});
});
spec/javascripts/diffs/components/diff_line_note_form_spec.js
View file @
290f8281
...
...
@@ -13,10 +13,10 @@ describe('DiffLineNoteForm', () => {
beforeEach
(()
=>
{
diffFile
=
getDiffFileMock
();
diffLines
=
diffFile
.
highlighted
DiffL
ines
;
diffLines
=
diffFile
.
highlighted
_diff_l
ines
;
component
=
createComponentWithStore
(
Vue
.
extend
(
DiffLineNoteForm
),
store
,
{
diffFileHash
:
diffFile
.
file
H
ash
,
diffFileHash
:
diffFile
.
file
_h
ash
,
diffLines
,
line
:
diffLines
[
0
],
noteTargetLine
:
diffLines
[
0
],
...
...
@@ -61,7 +61,7 @@ describe('DiffLineNoteForm', () => {
expect
(
window
.
confirm
).
not
.
toHaveBeenCalled
();
component
.
$nextTick
(()
=>
{
expect
(
component
.
cancelCommentForm
).
toHaveBeenCalledWith
({
lineCode
:
diffLines
[
0
].
line
C
ode
,
lineCode
:
diffLines
[
0
].
line
_c
ode
,
});
expect
(
component
.
resetAutoSave
).
toHaveBeenCalled
();
...
...
spec/javascripts/diffs/components/inline_diff_view_spec.js
View file @
290f8281
import
Vue
from
'
vue
'
;
import
'
~/behaviors/markdown/render_gfm
'
;
import
InlineDiffView
from
'
~/diffs/components/inline_diff_view.vue
'
;
import
store
from
'
~/mr_notes/stores
'
;
import
{
createComponentWithStore
}
from
'
spec/helpers/vue_mount_component_helper
'
;
...
...
@@ -10,14 +11,16 @@ describe('InlineDiffView', () => {
const
getDiffFileMock
=
()
=>
Object
.
assign
({},
diffFileMockData
);
const
getDiscussionsMockData
=
()
=>
[
Object
.
assign
({},
discussionsMockData
)];
beforeEach
(
()
=>
{
beforeEach
(
done
=>
{
const
diffFile
=
getDiffFileMock
();
store
.
dispatch
(
'
diffs/setInlineDiffViewType
'
);
component
=
createComponentWithStore
(
Vue
.
extend
(
InlineDiffView
),
store
,
{
diffFile
,
diffLines
:
diffFile
.
highlighted
DiffL
ines
,
diffLines
:
diffFile
.
highlighted
_diff_l
ines
,
}).
$mount
();
Vue
.
nextTick
(
done
);
});
describe
(
'
template
'
,
()
=>
{
...
...
@@ -32,7 +35,7 @@ describe('InlineDiffView', () => {
it
(
'
should render discussions
'
,
done
=>
{
const
el
=
component
.
$el
;
component
.
$store
.
dispatch
(
'
setInitialNotes
'
,
getDiscussionsMockData
()
);
component
.
diffLines
[
1
].
discussions
=
getDiscussionsMockData
(
);
Vue
.
nextTick
(()
=>
{
expect
(
el
.
querySelectorAll
(
'
.notes_holder
'
).
length
).
toEqual
(
1
);
...
...
spec/javascripts/diffs/components/parallel_diff_view_spec.js
View file @
290f8281
...
...
@@ -14,7 +14,7 @@ describe('ParallelDiffView', () => {
component
=
createComponentWithStore
(
Vue
.
extend
(
ParallelDiffView
),
store
,
{
diffFile
,
diffLines
:
diffFile
.
parallel
DiffL
ines
,
diffLines
:
diffFile
.
parallel
_diff_l
ines
,
}).
$mount
();
});
...
...
spec/javascripts/diffs/mock_data/diff_file.js
View file @
290f8281
export
default
{
submodule
:
false
,
submodule
L
ink
:
null
,
submodule
_l
ink
:
null
,
blob
:
{
id
:
'
9e10516ca50788acf18c518a231914a21e5f16f7
'
,
path
:
'
CHANGELOG
'
,
name
:
'
CHANGELOG
'
,
mode
:
'
100644
'
,
readable
T
ext
:
true
,
readable
_t
ext
:
true
,
icon
:
'
file-text-o
'
,
},
blob
P
ath
:
'
CHANGELOG
'
,
blob
N
ame
:
'
CHANGELOG
'
,
blob
I
con
:
'
<i aria-hidden="true" data-hidden="true" class="fa fa-file-text-o fa-fw"></i>
'
,
file
H
ash
:
'
1c497fbb3a46b78edf04cc2a2fa33f67e3ffbe2a
'
,
file
P
ath
:
'
CHANGELOG
'
,
new
F
ile
:
false
,
deleted
F
ile
:
false
,
renamed
F
ile
:
false
,
old
P
ath
:
'
CHANGELOG
'
,
new
P
ath
:
'
CHANGELOG
'
,
mode
C
hanged
:
false
,
a
M
ode
:
'
100644
'
,
b
M
ode
:
'
100644
'
,
blob
_p
ath
:
'
CHANGELOG
'
,
blob
_n
ame
:
'
CHANGELOG
'
,
blob
_i
con
:
'
<i aria-hidden="true" data-hidden="true" class="fa fa-file-text-o fa-fw"></i>
'
,
file
_h
ash
:
'
1c497fbb3a46b78edf04cc2a2fa33f67e3ffbe2a
'
,
file
_p
ath
:
'
CHANGELOG
'
,
new
_f
ile
:
false
,
deleted
_f
ile
:
false
,
renamed
_f
ile
:
false
,
old
_p
ath
:
'
CHANGELOG
'
,
new
_p
ath
:
'
CHANGELOG
'
,
mode
_c
hanged
:
false
,
a
_m
ode
:
'
100644
'
,
b
_m
ode
:
'
100644
'
,
text
:
true
,
viewer
:
{
name
:
'
text
'
,
},
added
L
ines
:
2
,
removed
L
ines
:
0
,
diff
R
efs
:
{
base
S
ha
:
'
e63f41fe459e62e1228fcef60d7189127aeba95a
'
,
start
S
ha
:
'
d9eaefe5a676b820c57ff18cf5b68316025f7962
'
,
head
S
ha
:
'
c48ee0d1bf3b30453f5b32250ce03134beaa6d13
'
,
added
_l
ines
:
2
,
removed
_l
ines
:
0
,
diff
_r
efs
:
{
base
_s
ha
:
'
e63f41fe459e62e1228fcef60d7189127aeba95a
'
,
start
_s
ha
:
'
d9eaefe5a676b820c57ff18cf5b68316025f7962
'
,
head
_s
ha
:
'
c48ee0d1bf3b30453f5b32250ce03134beaa6d13
'
,
},
content
S
ha
:
'
c48ee0d1bf3b30453f5b32250ce03134beaa6d13
'
,
stored
E
xternally
:
null
,
external
S
torage
:
null
,
old
PathH
tml
:
'
CHANGELOG
'
,
new
PathH
tml
:
'
CHANGELOG
'
,
edit
P
ath
:
'
/gitlab-org/gitlab-test/edit/spooky-stuff/CHANGELOG
'
,
view
P
ath
:
'
/gitlab-org/gitlab-test/blob/spooky-stuff/CHANGELOG
'
,
replaced
ViewP
ath
:
null
,
content
_s
ha
:
'
c48ee0d1bf3b30453f5b32250ce03134beaa6d13
'
,
stored
_e
xternally
:
null
,
external
_s
torage
:
null
,
old
_path_h
tml
:
'
CHANGELOG
'
,
new
_path_h
tml
:
'
CHANGELOG
'
,
edit
_p
ath
:
'
/gitlab-org/gitlab-test/edit/spooky-stuff/CHANGELOG
'
,
view
_p
ath
:
'
/gitlab-org/gitlab-test/blob/spooky-stuff/CHANGELOG
'
,
replaced
_view_p
ath
:
null
,
collapsed
:
false
,
renderIt
:
false
,
too
L
arge
:
false
,
context
LinesP
ath
:
too
_l
arge
:
false
,
context
_lines_p
ath
:
'
/gitlab-org/gitlab-test/blob/c48ee0d1bf3b30453f5b32250ce03134beaa6d13/CHANGELOG/diff
'
,
highlighted
DiffL
ines
:
[
highlighted
_diff_l
ines
:
[
{
line
C
ode
:
'
1c497fbb3a46b78edf04cc2a2fa33f67e3ffbe2a_1_1
'
,
line
_c
ode
:
'
1c497fbb3a46b78edf04cc2a2fa33f67e3ffbe2a_1_1
'
,
type
:
'
new
'
,
old
L
ine
:
null
,
new
L
ine
:
1
,
old
_l
ine
:
null
,
new
_l
ine
:
1
,
discussions
:
[],
text
:
'
+<span id="LC1" class="line" lang="plaintext"> - Bad dates</span>
\n
'
,
rich
T
ext
:
'
+<span id="LC1" class="line" lang="plaintext"> - Bad dates</span>
\n
'
,
meta
D
ata
:
null
,
rich
_t
ext
:
'
+<span id="LC1" class="line" lang="plaintext"> - Bad dates</span>
\n
'
,
meta
_d
ata
:
null
,
},
{
line
C
ode
:
'
1c497fbb3a46b78edf04cc2a2fa33f67e3ffbe2a_1_2
'
,
line
_c
ode
:
'
1c497fbb3a46b78edf04cc2a2fa33f67e3ffbe2a_1_2
'
,
type
:
'
new
'
,
old
L
ine
:
null
,
new
L
ine
:
2
,
old
_l
ine
:
null
,
new
_l
ine
:
2
,
discussions
:
[],
text
:
'
+<span id="LC2" class="line" lang="plaintext"></span>
\n
'
,
rich
T
ext
:
'
+<span id="LC2" class="line" lang="plaintext"></span>
\n
'
,
meta
D
ata
:
null
,
rich
_t
ext
:
'
+<span id="LC2" class="line" lang="plaintext"></span>
\n
'
,
meta
_d
ata
:
null
,
},
{
line
C
ode
:
'
1c497fbb3a46b78edf04cc2a2fa33f67e3ffbe2a_1_3
'
,
line
_c
ode
:
'
1c497fbb3a46b78edf04cc2a2fa33f67e3ffbe2a_1_3
'
,
type
:
null
,
old
L
ine
:
1
,
new
L
ine
:
3
,
old
_l
ine
:
1
,
new
_l
ine
:
3
,
discussions
:
[],
text
:
'
<span id="LC3" class="line" lang="plaintext">v6.8.0</span>
\n
'
,
rich
T
ext
:
'
<span id="LC3" class="line" lang="plaintext">v6.8.0</span>
\n
'
,
meta
D
ata
:
null
,
rich
_t
ext
:
'
<span id="LC3" class="line" lang="plaintext">v6.8.0</span>
\n
'
,
meta
_d
ata
:
null
,
},
{
line
C
ode
:
'
1c497fbb3a46b78edf04cc2a2fa33f67e3ffbe2a_2_4
'
,
line
_c
ode
:
'
1c497fbb3a46b78edf04cc2a2fa33f67e3ffbe2a_2_4
'
,
type
:
null
,
old
L
ine
:
2
,
new
L
ine
:
4
,
old
_l
ine
:
2
,
new
_l
ine
:
4
,
discussions
:
[],
text
:
'
<span id="LC4" class="line" lang="plaintext"></span>
\n
'
,
rich
T
ext
:
'
<span id="LC4" class="line" lang="plaintext"></span>
\n
'
,
meta
D
ata
:
null
,
rich
_t
ext
:
'
<span id="LC4" class="line" lang="plaintext"></span>
\n
'
,
meta
_d
ata
:
null
,
},
{
line
C
ode
:
'
1c497fbb3a46b78edf04cc2a2fa33f67e3ffbe2a_3_5
'
,
line
_c
ode
:
'
1c497fbb3a46b78edf04cc2a2fa33f67e3ffbe2a_3_5
'
,
type
:
null
,
old
L
ine
:
3
,
new
L
ine
:
5
,
old
_l
ine
:
3
,
new
_l
ine
:
5
,
discussions
:
[],
text
:
'
<span id="LC5" class="line" lang="plaintext">v6.7.0</span>
\n
'
,
rich
T
ext
:
'
<span id="LC5" class="line" lang="plaintext">v6.7.0</span>
\n
'
,
meta
D
ata
:
null
,
rich
_t
ext
:
'
<span id="LC5" class="line" lang="plaintext">v6.7.0</span>
\n
'
,
meta
_d
ata
:
null
,
},
{
line
C
ode
:
null
,
line
_c
ode
:
null
,
type
:
'
match
'
,
old
L
ine
:
null
,
new
L
ine
:
null
,
old
_l
ine
:
null
,
new
_l
ine
:
null
,
discussions
:
[],
text
:
''
,
rich
T
ext
:
''
,
meta
D
ata
:
{
old
P
os
:
3
,
new
P
os
:
5
,
rich
_t
ext
:
''
,
meta
_d
ata
:
{
old
_p
os
:
3
,
new
_p
os
:
5
,
},
},
],
parallel
DiffL
ines
:
[
parallel
_diff_l
ines
:
[
{
left
:
{
type
:
'
empty-cell
'
,
},
right
:
{
line
C
ode
:
'
1c497fbb3a46b78edf04cc2a2fa33f67e3ffbe2a_1_1
'
,
line
_c
ode
:
'
1c497fbb3a46b78edf04cc2a2fa33f67e3ffbe2a_1_1
'
,
type
:
'
new
'
,
old
L
ine
:
null
,
new
L
ine
:
1
,
old
_l
ine
:
null
,
new
_l
ine
:
1
,
discussions
:
[],
text
:
'
+<span id="LC1" class="line" lang="plaintext"> - Bad dates</span>
\n
'
,
rich
T
ext
:
'
<span id="LC1" class="line" lang="plaintext"> - Bad dates</span>
\n
'
,
meta
D
ata
:
null
,
rich
_t
ext
:
'
<span id="LC1" class="line" lang="plaintext"> - Bad dates</span>
\n
'
,
meta
_d
ata
:
null
,
},
},
{
...
...
@@ -132,107 +132,107 @@ export default {
type
:
'
empty-cell
'
,
},
right
:
{
line
C
ode
:
'
1c497fbb3a46b78edf04cc2a2fa33f67e3ffbe2a_1_2
'
,
line
_c
ode
:
'
1c497fbb3a46b78edf04cc2a2fa33f67e3ffbe2a_1_2
'
,
type
:
'
new
'
,
old
L
ine
:
null
,
new
L
ine
:
2
,
old
_l
ine
:
null
,
new
_l
ine
:
2
,
discussions
:
[],
text
:
'
+<span id="LC2" class="line" lang="plaintext"></span>
\n
'
,
rich
T
ext
:
'
<span id="LC2" class="line" lang="plaintext"></span>
\n
'
,
meta
D
ata
:
null
,
rich
_t
ext
:
'
<span id="LC2" class="line" lang="plaintext"></span>
\n
'
,
meta
_d
ata
:
null
,
},
},
{
left
:
{
lineCode
:
'
1c497fbb3a46b78edf04cc2a2fa33f67e3ffbe2a_1_3
'
,
line
_
Code
:
'
1c497fbb3a46b78edf04cc2a2fa33f67e3ffbe2a_1_3
'
,
type
:
null
,
old
L
ine
:
1
,
new
L
ine
:
3
,
old
_l
ine
:
1
,
new
_l
ine
:
3
,
discussions
:
[],
text
:
'
<span id="LC3" class="line" lang="plaintext">v6.8.0</span>
\n
'
,
rich
T
ext
:
'
<span id="LC3" class="line" lang="plaintext">v6.8.0</span>
\n
'
,
meta
D
ata
:
null
,
rich
_t
ext
:
'
<span id="LC3" class="line" lang="plaintext">v6.8.0</span>
\n
'
,
meta
_d
ata
:
null
,
},
right
:
{
line
C
ode
:
'
1c497fbb3a46b78edf04cc2a2fa33f67e3ffbe2a_1_3
'
,
line
_c
ode
:
'
1c497fbb3a46b78edf04cc2a2fa33f67e3ffbe2a_1_3
'
,
type
:
null
,
old
L
ine
:
1
,
new
L
ine
:
3
,
old
_l
ine
:
1
,
new
_l
ine
:
3
,
discussions
:
[],
text
:
'
<span id="LC3" class="line" lang="plaintext">v6.8.0</span>
\n
'
,
rich
T
ext
:
'
<span id="LC3" class="line" lang="plaintext">v6.8.0</span>
\n
'
,
meta
D
ata
:
null
,
rich
_t
ext
:
'
<span id="LC3" class="line" lang="plaintext">v6.8.0</span>
\n
'
,
meta
_d
ata
:
null
,
},
},
{
left
:
{
line
C
ode
:
'
1c497fbb3a46b78edf04cc2a2fa33f67e3ffbe2a_2_4
'
,
line
_c
ode
:
'
1c497fbb3a46b78edf04cc2a2fa33f67e3ffbe2a_2_4
'
,
type
:
null
,
old
L
ine
:
2
,
new
L
ine
:
4
,
old
_l
ine
:
2
,
new
_l
ine
:
4
,
discussions
:
[],
text
:
'
<span id="LC4" class="line" lang="plaintext"></span>
\n
'
,
rich
T
ext
:
'
<span id="LC4" class="line" lang="plaintext"></span>
\n
'
,
meta
D
ata
:
null
,
rich
_t
ext
:
'
<span id="LC4" class="line" lang="plaintext"></span>
\n
'
,
meta
_d
ata
:
null
,
},
right
:
{
line
C
ode
:
'
1c497fbb3a46b78edf04cc2a2fa33f67e3ffbe2a_2_4
'
,
line
_c
ode
:
'
1c497fbb3a46b78edf04cc2a2fa33f67e3ffbe2a_2_4
'
,
type
:
null
,
old
L
ine
:
2
,
new
L
ine
:
4
,
old
_l
ine
:
2
,
new
_l
ine
:
4
,
discussions
:
[],
text
:
'
<span id="LC4" class="line" lang="plaintext"></span>
\n
'
,
rich
T
ext
:
'
<span id="LC4" class="line" lang="plaintext"></span>
\n
'
,
meta
D
ata
:
null
,
rich
_t
ext
:
'
<span id="LC4" class="line" lang="plaintext"></span>
\n
'
,
meta
_d
ata
:
null
,
},
},
{
left
:
{
line
C
ode
:
'
1c497fbb3a46b78edf04cc2a2fa33f67e3ffbe2a_3_5
'
,
line
_c
ode
:
'
1c497fbb3a46b78edf04cc2a2fa33f67e3ffbe2a_3_5
'
,
type
:
null
,
old
L
ine
:
3
,
new
L
ine
:
5
,
old
_l
ine
:
3
,
new
_l
ine
:
5
,
discussions
:
[],
text
:
'
<span id="LC5" class="line" lang="plaintext">v6.7.0</span>
\n
'
,
rich
T
ext
:
'
<span id="LC5" class="line" lang="plaintext">v6.7.0</span>
\n
'
,
meta
D
ata
:
null
,
rich
_t
ext
:
'
<span id="LC5" class="line" lang="plaintext">v6.7.0</span>
\n
'
,
meta
_d
ata
:
null
,
},
right
:
{
line
C
ode
:
'
1c497fbb3a46b78edf04cc2a2fa33f67e3ffbe2a_3_5
'
,
line
_c
ode
:
'
1c497fbb3a46b78edf04cc2a2fa33f67e3ffbe2a_3_5
'
,
type
:
null
,
old
L
ine
:
3
,
new
L
ine
:
5
,
old
_l
ine
:
3
,
new
_l
ine
:
5
,
discussions
:
[],
text
:
'
<span id="LC5" class="line" lang="plaintext">v6.7.0</span>
\n
'
,
rich
T
ext
:
'
<span id="LC5" class="line" lang="plaintext">v6.7.0</span>
\n
'
,
meta
D
ata
:
null
,
rich
_t
ext
:
'
<span id="LC5" class="line" lang="plaintext">v6.7.0</span>
\n
'
,
meta
_d
ata
:
null
,
},
},
{
left
:
{
line
C
ode
:
null
,
line
_c
ode
:
null
,
type
:
'
match
'
,
old
L
ine
:
null
,
new
L
ine
:
null
,
old
_l
ine
:
null
,
new
_l
ine
:
null
,
discussions
:
[],
text
:
''
,
rich
T
ext
:
''
,
meta
D
ata
:
{
old
P
os
:
3
,
new
P
os
:
5
,
rich
_t
ext
:
''
,
meta
_d
ata
:
{
old
_p
os
:
3
,
new
_p
os
:
5
,
},
},
right
:
{
line
C
ode
:
null
,
line
_c
ode
:
null
,
type
:
'
match
'
,
old
L
ine
:
null
,
new
L
ine
:
null
,
old
_l
ine
:
null
,
new
_l
ine
:
null
,
discussions
:
[],
text
:
''
,
rich
T
ext
:
''
,
meta
D
ata
:
{
old
P
os
:
3
,
new
P
os
:
5
,
rich
_t
ext
:
''
,
meta
_d
ata
:
{
old
_p
os
:
3
,
new
_p
os
:
5
,
},
},
},
...
...
spec/javascripts/diffs/mock_data/diff_with_commit.js
View file @
290f8281
import
{
convertObjectPropsToCamelCase
}
from
'
~/lib/utils/common_utils
'
;
const
FIXTURE
=
'
merge_request_diffs/with_commit.json
'
;
preloadFixtures
(
FIXTURE
);
export
default
function
getDiffWithCommit
()
{
return
convertObjectPropsToCamelCase
(
getJSONFixture
(
FIXTURE
),
{
deep
:
true
}
);
return
getJSONFixture
(
FIXTURE
);
}
spec/javascripts/diffs/store/actions_spec.js
View file @
290f8281
...
...
@@ -97,46 +97,46 @@ describe('DiffsStoreActions', () => {
const
state
=
{
diffFiles
:
[
{
file
H
ash
:
'
ABC
'
,
parallel
DiffL
ines
:
[
file
_h
ash
:
'
ABC
'
,
parallel
_diff_l
ines
:
[
{
left
:
{
line
C
ode
:
'
ABC_1_1
'
,
line
_c
ode
:
'
ABC_1_1
'
,
discussions
:
[],
},
right
:
{
line
C
ode
:
'
ABC_1_1
'
,
line
_c
ode
:
'
ABC_1_1
'
,
discussions
:
[],
},
},
],
highlighted
DiffL
ines
:
[
highlighted
_diff_l
ines
:
[
{
line
C
ode
:
'
ABC_1_1
'
,
line
_c
ode
:
'
ABC_1_1
'
,
discussions
:
[],
old
L
ine
:
5
,
new
L
ine
:
null
,
old
_l
ine
:
5
,
new
_l
ine
:
null
,
},
],
diff
R
efs
:
{
base
S
ha
:
'
abc
'
,
head
S
ha
:
'
def
'
,
start
S
ha
:
'
ghi
'
,
diff
_r
efs
:
{
base
_s
ha
:
'
abc
'
,
head
_s
ha
:
'
def
'
,
start
_s
ha
:
'
ghi
'
,
},
new
P
ath
:
'
file1
'
,
old
P
ath
:
'
file2
'
,
new
_p
ath
:
'
file1
'
,
old
_p
ath
:
'
file2
'
,
},
],
};
const
diffPosition
=
{
base
S
ha
:
'
abc
'
,
head
S
ha
:
'
def
'
,
start
S
ha
:
'
ghi
'
,
new
L
ine
:
null
,
new
P
ath
:
'
file1
'
,
old
L
ine
:
5
,
old
P
ath
:
'
file2
'
,
base
_s
ha
:
'
abc
'
,
head
_s
ha
:
'
def
'
,
start
_s
ha
:
'
ghi
'
,
new
_l
ine
:
null
,
new
_p
ath
:
'
file1
'
,
old
_l
ine
:
5
,
old
_p
ath
:
'
file2
'
,
};
const
singleDiscussion
=
{
...
...
@@ -145,7 +145,7 @@ describe('DiffsStoreActions', () => {
diff_file
:
{
file_hash
:
'
ABC
'
,
},
file
H
ash
:
'
ABC
'
,
file
_h
ash
:
'
ABC
'
,
resolvable
:
true
,
position
:
diffPosition
,
original_position
:
diffPosition
,
...
...
@@ -164,24 +164,22 @@ describe('DiffsStoreActions', () => {
discussion
:
singleDiscussion
,
diffPositionByLineCode
:
{
ABC_1_1
:
{
base
S
ha
:
'
abc
'
,
head
S
ha
:
'
def
'
,
start
S
ha
:
'
ghi
'
,
new
L
ine
:
null
,
new
P
ath
:
'
file1
'
,
old
L
ine
:
5
,
old
P
ath
:
'
file2
'
,
line
C
ode
:
'
ABC_1_1
'
,
position
T
ype
:
'
text
'
,
base
_s
ha
:
'
abc
'
,
head
_s
ha
:
'
def
'
,
start
_s
ha
:
'
ghi
'
,
new
_l
ine
:
null
,
new
_p
ath
:
'
file1
'
,
old
_l
ine
:
5
,
old
_p
ath
:
'
file2
'
,
line
_c
ode
:
'
ABC_1_1
'
,
position
_t
ype
:
'
text
'
,
},
},
},
},
],
[],
()
=>
{
done
();
},
done
,
);
});
});
...
...
@@ -191,11 +189,11 @@ describe('DiffsStoreActions', () => {
const
state
=
{
diffFiles
:
[
{
file
H
ash
:
'
ABC
'
,
parallel
DiffL
ines
:
[
file
_h
ash
:
'
ABC
'
,
parallel
_diff_l
ines
:
[
{
left
:
{
line
C
ode
:
'
ABC_1_1
'
,
line
_c
ode
:
'
ABC_1_1
'
,
discussions
:
[
{
id
:
1
,
...
...
@@ -203,14 +201,14 @@ describe('DiffsStoreActions', () => {
],
},
right
:
{
line
C
ode
:
'
ABC_1_1
'
,
line
_c
ode
:
'
ABC_1_1
'
,
discussions
:
[],
},
},
],
highlighted
DiffL
ines
:
[
highlighted
_diff_l
ines
:
[
{
line
C
ode
:
'
ABC_1_1
'
,
line
_c
ode
:
'
ABC_1_1
'
,
discussions
:
[],
},
],
...
...
@@ -219,7 +217,7 @@ describe('DiffsStoreActions', () => {
};
const
singleDiscussion
=
{
id
:
'
1
'
,
file
H
ash
:
'
ABC
'
,
file
_h
ash
:
'
ABC
'
,
line_code
:
'
ABC_1_1
'
,
};
...
...
@@ -238,9 +236,7 @@ describe('DiffsStoreActions', () => {
},
],
[],
()
=>
{
done
();
},
done
,
);
});
});
...
...
spec/javascripts/diffs/store/getters_spec.js
View file @
290f8281
...
...
@@ -195,12 +195,12 @@ describe('Diffs Module Getters', () => {
discussionMock
.
expanded
=
true
;
line
.
left
=
{
line
C
ode
:
'
ABC
'
,
line
_c
ode
:
'
ABC
'
,
discussions
:
[
discussionMock
],
};
line
.
right
=
{
line
C
ode
:
'
DEF
'
,
line
_c
ode
:
'
DEF
'
,
discussions
:
[
discussionMock1
],
};
});
...
...
@@ -259,7 +259,7 @@ describe('Diffs Module Getters', () => {
describe
(
'
getDiffFileDiscussions
'
,
()
=>
{
it
(
'
returns an array with discussions when fileHash matches and the discussion belongs to a diff
'
,
()
=>
{
discussionMock
.
diff_file
.
file_hash
=
diffFileMock
.
file
H
ash
;
discussionMock
.
diff_file
.
file_hash
=
diffFileMock
.
file
_h
ash
;
expect
(
getters
.
getDiffFileDiscussions
(
localState
,
{},
{},
{
discussions
:
[
discussionMock
]
})(
...
...
@@ -279,10 +279,10 @@ describe('Diffs Module Getters', () => {
describe
(
'
getDiffFileByHash
'
,
()
=>
{
it
(
'
returns file by hash
'
,
()
=>
{
const
fileA
=
{
file
H
ash
:
'
123
'
,
file
_h
ash
:
'
123
'
,
};
const
fileB
=
{
file
H
ash
:
'
456
'
,
file
_h
ash
:
'
456
'
,
};
localState
.
diffFiles
=
[
fileA
,
fileB
];
...
...
spec/javascripts/diffs/store/mutations_spec.js
View file @
290f8281
...
...
@@ -37,7 +37,7 @@ describe('DiffsStoreMutations', () => {
mutations
[
types
.
SET_DIFF_DATA
](
state
,
diffMock
);
const
firstLine
=
state
.
diffFiles
[
0
].
parallel
DiffL
ines
[
0
];
const
firstLine
=
state
.
diffFiles
[
0
].
parallel
_diff_l
ines
[
0
];
expect
(
firstLine
.
right
.
text
).
toBeUndefined
();
expect
(
state
.
diffFiles
[
0
].
renderIt
).
toEqual
(
true
);
...
...
@@ -98,19 +98,19 @@ describe('DiffsStoreMutations', () => {
it
(
'
should call utils.addContextLines with proper params
'
,
()
=>
{
const
options
=
{
lineNumbers
:
{
oldLineNumber
:
1
,
newLineNumber
:
2
},
contextLines
:
[{
old
Line
:
1
,
newLine
:
1
,
lineC
ode
:
'
ff9200_1_1
'
,
discussions
:
[]
}],
contextLines
:
[{
old
_line
:
1
,
new_line
:
1
,
line_c
ode
:
'
ff9200_1_1
'
,
discussions
:
[]
}],
fileHash
:
'
ff9200
'
,
params
:
{
bottom
:
true
,
},
};
const
diffFile
=
{
file
H
ash
:
options
.
fileHash
,
highlighted
DiffL
ines
:
[],
parallel
DiffL
ines
:
[],
file
_h
ash
:
options
.
fileHash
,
highlighted
_diff_l
ines
:
[],
parallel
_diff_l
ines
:
[],
};
const
state
=
{
diffFiles
:
[
diffFile
]
};
const
lines
=
[{
old
Line
:
1
,
newL
ine
:
1
}];
const
lines
=
[{
old
_line
:
1
,
new_l
ine
:
1
}];
const
findDiffFileSpy
=
spyOnDependency
(
mutations
,
'
findDiffFile
'
).
and
.
returnValue
(
diffFile
);
const
removeMatchLineSpy
=
spyOnDependency
(
mutations
,
'
removeMatchLine
'
);
...
...
@@ -133,8 +133,8 @@ describe('DiffsStoreMutations', () => {
);
expect
(
addContextLinesSpy
).
toHaveBeenCalledWith
({
inlineLines
:
diffFile
.
highlighted
DiffL
ines
,
parallelLines
:
diffFile
.
parallel
DiffL
ines
,
inlineLines
:
diffFile
.
highlighted
_diff_l
ines
,
parallelLines
:
diffFile
.
parallel
_diff_l
ines
,
contextLines
:
options
.
contextLines
,
bottom
:
options
.
params
.
bottom
,
lineNumbers
:
options
.
lineNumbers
,
...
...
@@ -144,54 +144,50 @@ describe('DiffsStoreMutations', () => {
describe
(
'
ADD_COLLAPSED_DIFFS
'
,
()
=>
{
it
(
'
should update the state with the given data for the given file hash
'
,
()
=>
{
const
spy
=
spyOnDependency
(
mutations
,
'
convertObjectPropsToCamelCase
'
).
and
.
callThrough
();
const
fileHash
=
123
;
const
state
=
{
diffFiles
:
[{},
{
file
Hash
,
existingF
ield
:
0
}]
};
const
data
=
{
diff_files
:
[{
file_hash
:
fileHash
,
extra_field
:
1
,
existing
F
ield
:
1
}]
};
const
state
=
{
diffFiles
:
[{},
{
file
_hash
:
fileHash
,
existing_f
ield
:
0
}]
};
const
data
=
{
diff_files
:
[{
file_hash
:
fileHash
,
extra_field
:
1
,
existing
_f
ield
:
1
}]
};
mutations
[
types
.
ADD_COLLAPSED_DIFFS
](
state
,
{
file
:
state
.
diffFiles
[
1
],
data
});
expect
(
spy
).
toHaveBeenCalledWith
(
data
,
{
deep
:
true
});
expect
(
state
.
diffFiles
[
1
].
fileHash
).
toEqual
(
fileHash
);
expect
(
state
.
diffFiles
[
1
].
existingField
).
toEqual
(
1
);
expect
(
state
.
diffFiles
[
1
].
extraField
).
toEqual
(
1
);
expect
(
state
.
diffFiles
[
1
].
file_hash
).
toEqual
(
fileHash
);
expect
(
state
.
diffFiles
[
1
].
existing_field
).
toEqual
(
1
);
expect
(
state
.
diffFiles
[
1
].
extra_field
).
toEqual
(
1
);
});
});
describe
(
'
SET_LINE_DISCUSSIONS_FOR_FILE
'
,
()
=>
{
it
(
'
should add discussions to the given line
'
,
()
=>
{
const
diffPosition
=
{
base
S
ha
:
'
ed13df29948c41ba367caa757ab3ec4892509910
'
,
head
S
ha
:
'
b921914f9a834ac47e6fd9420f78db0f83559130
'
,
new
L
ine
:
null
,
new
P
ath
:
'
500-lines-4.txt
'
,
old
L
ine
:
5
,
old
P
ath
:
'
500-lines-4.txt
'
,
start
S
ha
:
'
ed13df29948c41ba367caa757ab3ec4892509910
'
,
base
_s
ha
:
'
ed13df29948c41ba367caa757ab3ec4892509910
'
,
head
_s
ha
:
'
b921914f9a834ac47e6fd9420f78db0f83559130
'
,
new
_l
ine
:
null
,
new
_p
ath
:
'
500-lines-4.txt
'
,
old
_l
ine
:
5
,
old
_p
ath
:
'
500-lines-4.txt
'
,
start
_s
ha
:
'
ed13df29948c41ba367caa757ab3ec4892509910
'
,
};
const
state
=
{
latestDiff
:
true
,
diffFiles
:
[
{
file
H
ash
:
'
ABC
'
,
parallel
DiffL
ines
:
[
file
_h
ash
:
'
ABC
'
,
parallel
_diff_l
ines
:
[
{
left
:
{
line
C
ode
:
'
ABC_1
'
,
line
_c
ode
:
'
ABC_1
'
,
discussions
:
[],
},
right
:
{
line
C
ode
:
'
ABC_1
'
,
line
_c
ode
:
'
ABC_1
'
,
discussions
:
[],
},
},
],
highlighted
DiffL
ines
:
[
highlighted
_diff_l
ines
:
[
{
line
C
ode
:
'
ABC_1
'
,
line
_c
ode
:
'
ABC_1
'
,
discussions
:
[],
},
],
...
...
@@ -206,7 +202,7 @@ describe('DiffsStoreMutations', () => {
original_position
:
diffPosition
,
position
:
diffPosition
,
diff_file
:
{
file_hash
:
state
.
diffFiles
[
0
].
file
H
ash
,
file_hash
:
state
.
diffFiles
[
0
].
file
_h
ash
,
},
};
...
...
@@ -219,46 +215,46 @@ describe('DiffsStoreMutations', () => {
diffPositionByLineCode
,
});
expect
(
state
.
diffFiles
[
0
].
parallel
DiffL
ines
[
0
].
left
.
discussions
.
length
).
toEqual
(
1
);
expect
(
state
.
diffFiles
[
0
].
parallel
DiffL
ines
[
0
].
left
.
discussions
[
0
].
id
).
toEqual
(
1
);
expect
(
state
.
diffFiles
[
0
].
parallel
DiffL
ines
[
0
].
right
.
discussions
).
toEqual
([]);
expect
(
state
.
diffFiles
[
0
].
parallel
_diff_l
ines
[
0
].
left
.
discussions
.
length
).
toEqual
(
1
);
expect
(
state
.
diffFiles
[
0
].
parallel
_diff_l
ines
[
0
].
left
.
discussions
[
0
].
id
).
toEqual
(
1
);
expect
(
state
.
diffFiles
[
0
].
parallel
_diff_l
ines
[
0
].
right
.
discussions
).
toEqual
([]);
expect
(
state
.
diffFiles
[
0
].
highlighted
DiffL
ines
[
0
].
discussions
.
length
).
toEqual
(
1
);
expect
(
state
.
diffFiles
[
0
].
highlighted
DiffL
ines
[
0
].
discussions
[
0
].
id
).
toEqual
(
1
);
expect
(
state
.
diffFiles
[
0
].
highlighted
_diff_l
ines
[
0
].
discussions
.
length
).
toEqual
(
1
);
expect
(
state
.
diffFiles
[
0
].
highlighted
_diff_l
ines
[
0
].
discussions
[
0
].
id
).
toEqual
(
1
);
});
it
(
'
should add legacy discussions to the given line
'
,
()
=>
{
const
diffPosition
=
{
base
S
ha
:
'
ed13df29948c41ba367caa757ab3ec4892509910
'
,
head
S
ha
:
'
b921914f9a834ac47e6fd9420f78db0f83559130
'
,
new
L
ine
:
null
,
new
P
ath
:
'
500-lines-4.txt
'
,
old
L
ine
:
5
,
old
P
ath
:
'
500-lines-4.txt
'
,
start
S
ha
:
'
ed13df29948c41ba367caa757ab3ec4892509910
'
,
line
C
ode
:
'
ABC_1
'
,
base
_s
ha
:
'
ed13df29948c41ba367caa757ab3ec4892509910
'
,
head
_s
ha
:
'
b921914f9a834ac47e6fd9420f78db0f83559130
'
,
new
_l
ine
:
null
,
new
_p
ath
:
'
500-lines-4.txt
'
,
old
_l
ine
:
5
,
old
_p
ath
:
'
500-lines-4.txt
'
,
start
_s
ha
:
'
ed13df29948c41ba367caa757ab3ec4892509910
'
,
line
_c
ode
:
'
ABC_1
'
,
};
const
state
=
{
latestDiff
:
true
,
diffFiles
:
[
{
file
H
ash
:
'
ABC
'
,
parallel
DiffL
ines
:
[
file
_h
ash
:
'
ABC
'
,
parallel
_diff_l
ines
:
[
{
left
:
{
line
C
ode
:
'
ABC_1
'
,
line
_c
ode
:
'
ABC_1
'
,
discussions
:
[],
},
right
:
{
line
C
ode
:
'
ABC_1
'
,
line
_c
ode
:
'
ABC_1
'
,
discussions
:
[],
},
},
],
highlighted
DiffL
ines
:
[
highlighted
_diff_l
ines
:
[
{
line
C
ode
:
'
ABC_1
'
,
line
_c
ode
:
'
ABC_1
'
,
discussions
:
[],
},
],
...
...
@@ -271,7 +267,7 @@ describe('DiffsStoreMutations', () => {
diff_discussion
:
true
,
active
:
true
,
diff_file
:
{
file_hash
:
state
.
diffFiles
[
0
].
file
H
ash
,
file_hash
:
state
.
diffFiles
[
0
].
file
_h
ash
,
},
};
...
...
@@ -284,11 +280,11 @@ describe('DiffsStoreMutations', () => {
diffPositionByLineCode
,
});
expect
(
state
.
diffFiles
[
0
].
parallel
DiffL
ines
[
0
].
left
.
discussions
.
length
).
toEqual
(
1
);
expect
(
state
.
diffFiles
[
0
].
parallel
DiffL
ines
[
0
].
left
.
discussions
[
0
].
id
).
toEqual
(
1
);
expect
(
state
.
diffFiles
[
0
].
parallel
_diff_l
ines
[
0
].
left
.
discussions
.
length
).
toEqual
(
1
);
expect
(
state
.
diffFiles
[
0
].
parallel
_diff_l
ines
[
0
].
left
.
discussions
[
0
].
id
).
toEqual
(
1
);
expect
(
state
.
diffFiles
[
0
].
highlighted
DiffL
ines
[
0
].
discussions
.
length
).
toEqual
(
1
);
expect
(
state
.
diffFiles
[
0
].
highlighted
DiffL
ines
[
0
].
discussions
[
0
].
id
).
toEqual
(
1
);
expect
(
state
.
diffFiles
[
0
].
highlighted
_diff_l
ines
[
0
].
discussions
.
length
).
toEqual
(
1
);
expect
(
state
.
diffFiles
[
0
].
highlighted
_diff_l
ines
[
0
].
discussions
[
0
].
id
).
toEqual
(
1
);
});
});
...
...
@@ -297,11 +293,11 @@ describe('DiffsStoreMutations', () => {
const
state
=
{
diffFiles
:
[
{
file
H
ash
:
'
ABC
'
,
parallel
DiffL
ines
:
[
file
_h
ash
:
'
ABC
'
,
parallel
_diff_l
ines
:
[
{
left
:
{
line
C
ode
:
'
ABC_1
'
,
line
_c
ode
:
'
ABC_1
'
,
discussions
:
[
{
id
:
1
,
...
...
@@ -314,14 +310,14 @@ describe('DiffsStoreMutations', () => {
],
},
right
:
{
line
C
ode
:
'
ABC_1
'
,
line
_c
ode
:
'
ABC_1
'
,
discussions
:
[],
},
},
],
highlighted
DiffL
ines
:
[
highlighted
_diff_l
ines
:
[
{
line
C
ode
:
'
ABC_1
'
,
line
_c
ode
:
'
ABC_1
'
,
discussions
:
[
{
id
:
1
,
...
...
@@ -343,8 +339,8 @@ describe('DiffsStoreMutations', () => {
lineCode
:
'
ABC_1
'
,
});
expect
(
state
.
diffFiles
[
0
].
parallel
DiffL
ines
[
0
].
left
.
discussions
.
length
).
toEqual
(
0
);
expect
(
state
.
diffFiles
[
0
].
highlighted
DiffL
ines
[
0
].
discussions
.
length
).
toEqual
(
0
);
expect
(
state
.
diffFiles
[
0
].
parallel
_diff_l
ines
[
0
].
left
.
discussions
.
length
).
toEqual
(
0
);
expect
(
state
.
diffFiles
[
0
].
highlighted
_diff_l
ines
[
0
].
discussions
.
length
).
toEqual
(
0
);
});
});
...
...
spec/javascripts/diffs/store/utils_spec.js
View file @
290f8281
...
...
@@ -18,7 +18,7 @@ const getDiffFileMock = () => Object.assign({}, diffFileMockData);
describe
(
'
DiffsStoreUtils
'
,
()
=>
{
describe
(
'
findDiffFile
'
,
()
=>
{
const
files
=
[{
file
H
ash
:
1
,
name
:
'
one
'
}];
const
files
=
[{
file
_h
ash
:
1
,
name
:
'
one
'
}];
it
(
'
should return correct file
'
,
()
=>
{
expect
(
utils
.
findDiffFile
(
files
,
1
).
name
).
toEqual
(
'
one
'
);
...
...
@@ -41,13 +41,13 @@ describe('DiffsStoreUtils', () => {
describe
(
'
findIndexInInlineLines
'
,
()
=>
{
it
(
'
should return correct index for given line numbers
'
,
()
=>
{
expectSet
(
utils
.
findIndexInInlineLines
,
getDiffFileMock
().
highlighted
DiffL
ines
);
expectSet
(
utils
.
findIndexInInlineLines
,
getDiffFileMock
().
highlighted
_diff_l
ines
);
});
});
describe
(
'
findIndexInParallelLines
'
,
()
=>
{
it
(
'
should return correct index for given line numbers
'
,
()
=>
{
expectSet
(
utils
.
findIndexInParallelLines
,
getDiffFileMock
().
parallel
DiffL
ines
,
{});
expectSet
(
utils
.
findIndexInParallelLines
,
getDiffFileMock
().
parallel
_diff_l
ines
,
{});
});
});
});
...
...
@@ -56,33 +56,39 @@ describe('DiffsStoreUtils', () => {
it
(
'
should remove match line properly by regarding the bottom parameter
'
,
()
=>
{
const
diffFile
=
getDiffFileMock
();
const
lineNumbers
=
{
oldLineNumber
:
3
,
newLineNumber
:
5
};
const
inlineIndex
=
utils
.
findIndexInInlineLines
(
diffFile
.
highlightedDiffLines
,
lineNumbers
);
const
parallelIndex
=
utils
.
findIndexInParallelLines
(
diffFile
.
parallelDiffLines
,
lineNumbers
);
const
atInlineIndex
=
diffFile
.
highlightedDiffLines
[
inlineIndex
];
const
atParallelIndex
=
diffFile
.
parallelDiffLines
[
parallelIndex
];
const
inlineIndex
=
utils
.
findIndexInInlineLines
(
diffFile
.
highlighted_diff_lines
,
lineNumbers
,
);
const
parallelIndex
=
utils
.
findIndexInParallelLines
(
diffFile
.
parallel_diff_lines
,
lineNumbers
,
);
const
atInlineIndex
=
diffFile
.
highlighted_diff_lines
[
inlineIndex
];
const
atParallelIndex
=
diffFile
.
parallel_diff_lines
[
parallelIndex
];
utils
.
removeMatchLine
(
diffFile
,
lineNumbers
,
false
);
expect
(
diffFile
.
highlighted
DiffL
ines
[
inlineIndex
]).
not
.
toEqual
(
atInlineIndex
);
expect
(
diffFile
.
parallel
DiffL
ines
[
parallelIndex
]).
not
.
toEqual
(
atParallelIndex
);
expect
(
diffFile
.
highlighted
_diff_l
ines
[
inlineIndex
]).
not
.
toEqual
(
atInlineIndex
);
expect
(
diffFile
.
parallel
_diff_l
ines
[
parallelIndex
]).
not
.
toEqual
(
atParallelIndex
);
utils
.
removeMatchLine
(
diffFile
,
lineNumbers
,
true
);
expect
(
diffFile
.
highlighted
DiffL
ines
[
inlineIndex
+
1
]).
not
.
toEqual
(
atInlineIndex
);
expect
(
diffFile
.
parallel
DiffL
ines
[
parallelIndex
+
1
]).
not
.
toEqual
(
atParallelIndex
);
expect
(
diffFile
.
highlighted
_diff_l
ines
[
inlineIndex
+
1
]).
not
.
toEqual
(
atInlineIndex
);
expect
(
diffFile
.
parallel
_diff_l
ines
[
parallelIndex
+
1
]).
not
.
toEqual
(
atParallelIndex
);
});
});
describe
(
'
addContextLines
'
,
()
=>
{
it
(
'
should add context lines properly with bottom parameter
'
,
()
=>
{
const
diffFile
=
getDiffFileMock
();
const
inlineLines
=
diffFile
.
highlighted
DiffL
ines
;
const
parallelLines
=
diffFile
.
parallel
DiffL
ines
;
const
inlineLines
=
diffFile
.
highlighted
_diff_l
ines
;
const
parallelLines
=
diffFile
.
parallel
_diff_l
ines
;
const
lineNumbers
=
{
oldLineNumber
:
3
,
newLineNumber
:
5
};
const
contextLines
=
[{
lineNumber
:
42
}];
const
options
=
{
inlineLines
,
parallelLines
,
contextLines
,
lineNumbers
,
bottom
:
true
};
const
inlineIndex
=
utils
.
findIndexInInlineLines
(
diffFile
.
highlightedDiff
Lines
,
lineNumbers
);
const
parallelIndex
=
utils
.
findIndexInParallelLines
(
diffFile
.
parallelDiff
Lines
,
lineNumbers
);
const
inlineIndex
=
utils
.
findIndexInInlineLines
(
inline
Lines
,
lineNumbers
);
const
parallelIndex
=
utils
.
findIndexInParallelLines
(
parallel
Lines
,
lineNumbers
);
const
normalizedParallelLine
=
{
left
:
options
.
contextLines
[
0
],
right
:
options
.
contextLines
[
0
],
...
...
@@ -112,30 +118,30 @@ describe('DiffsStoreUtils', () => {
noteableType
:
MERGE_REQUEST_NOTEABLE_TYPE
,
diffFile
,
noteTargetLine
:
{
line
C
ode
:
'
1c497fbb3a46b78edf04cc2a2fa33f67e3ffbe2a_1_3
'
,
meta
D
ata
:
null
,
new
L
ine
:
3
,
old
L
ine
:
1
,
line
_c
ode
:
'
1c497fbb3a46b78edf04cc2a2fa33f67e3ffbe2a_1_3
'
,
meta
_d
ata
:
null
,
new
_l
ine
:
3
,
old
_l
ine
:
1
,
},
diffViewType
:
PARALLEL_DIFF_VIEW_TYPE
,
linePosition
:
LINE_POSITION_LEFT
,
};
const
position
=
JSON
.
stringify
({
base_sha
:
diffFile
.
diff
Refs
.
baseS
ha
,
start_sha
:
diffFile
.
diff
Refs
.
startS
ha
,
head_sha
:
diffFile
.
diff
Refs
.
headS
ha
,
old_path
:
diffFile
.
old
P
ath
,
new_path
:
diffFile
.
new
P
ath
,
base_sha
:
diffFile
.
diff
_refs
.
base_s
ha
,
start_sha
:
diffFile
.
diff
_refs
.
start_s
ha
,
head_sha
:
diffFile
.
diff
_refs
.
head_s
ha
,
old_path
:
diffFile
.
old
_p
ath
,
new_path
:
diffFile
.
new
_p
ath
,
position_type
:
TEXT_DIFF_POSITION_TYPE
,
old_line
:
options
.
noteTargetLine
.
old
L
ine
,
new_line
:
options
.
noteTargetLine
.
new
L
ine
,
old_line
:
options
.
noteTargetLine
.
old
_l
ine
,
new_line
:
options
.
noteTargetLine
.
new
_l
ine
,
});
const
postData
=
{
view
:
options
.
diffViewType
,
line_type
:
options
.
linePosition
===
LINE_POSITION_RIGHT
?
NEW_LINE_TYPE
:
OLD_LINE_TYPE
,
merge_request_diff_head_sha
:
diffFile
.
diff
Refs
.
headS
ha
,
merge_request_diff_head_sha
:
diffFile
.
diff
_refs
.
head_s
ha
,
in_reply_to_discussion_id
:
''
,
note_project_id
:
''
,
target_type
:
options
.
noteableType
,
...
...
@@ -146,7 +152,7 @@ describe('DiffsStoreUtils', () => {
noteable_id
:
options
.
noteableData
.
id
,
commit_id
:
''
,
type
:
DIFF_NOTE_TYPE
,
line_code
:
options
.
noteTargetLine
.
line
C
ode
,
line_code
:
options
.
noteTargetLine
.
line
_c
ode
,
note
:
options
.
note
,
position
,
},
...
...
@@ -160,8 +166,8 @@ describe('DiffsStoreUtils', () => {
it
(
'
should create legacy note form data
'
,
()
=>
{
const
diffFile
=
getDiffFileMock
();
delete
diffFile
.
diff
Refs
.
startS
ha
;
delete
diffFile
.
diff
Refs
.
headS
ha
;
delete
diffFile
.
diff
_refs
.
start_s
ha
;
delete
diffFile
.
diff
_refs
.
head_s
ha
;
noteableDataMock
.
targetType
=
MERGE_REQUEST_NOTEABLE_TYPE
;
...
...
@@ -171,24 +177,24 @@ describe('DiffsStoreUtils', () => {
noteableType
:
MERGE_REQUEST_NOTEABLE_TYPE
,
diffFile
,
noteTargetLine
:
{
line
C
ode
:
'
1c497fbb3a46b78edf04cc2a2fa33f67e3ffbe2a_1_3
'
,
meta
D
ata
:
null
,
new
L
ine
:
3
,
old
L
ine
:
1
,
line
_c
ode
:
'
1c497fbb3a46b78edf04cc2a2fa33f67e3ffbe2a_1_3
'
,
meta
_d
ata
:
null
,
new
_l
ine
:
3
,
old
_l
ine
:
1
,
},
diffViewType
:
PARALLEL_DIFF_VIEW_TYPE
,
linePosition
:
LINE_POSITION_LEFT
,
};
const
position
=
JSON
.
stringify
({
base_sha
:
diffFile
.
diff
Refs
.
baseS
ha
,
base_sha
:
diffFile
.
diff
_refs
.
base_s
ha
,
start_sha
:
undefined
,
head_sha
:
undefined
,
old_path
:
diffFile
.
old
P
ath
,
new_path
:
diffFile
.
new
P
ath
,
old_path
:
diffFile
.
old
_p
ath
,
new_path
:
diffFile
.
new
_p
ath
,
position_type
:
TEXT_DIFF_POSITION_TYPE
,
old_line
:
options
.
noteTargetLine
.
old
L
ine
,
new_line
:
options
.
noteTargetLine
.
new
L
ine
,
old_line
:
options
.
noteTargetLine
.
old
_l
ine
,
new_line
:
options
.
noteTargetLine
.
new
_l
ine
,
});
const
postData
=
{
...
...
@@ -205,7 +211,7 @@ describe('DiffsStoreUtils', () => {
noteable_id
:
options
.
noteableData
.
id
,
commit_id
:
''
,
type
:
LEGACY_DIFF_NOTE_TYPE
,
line_code
:
options
.
noteTargetLine
.
line
C
ode
,
line_code
:
options
.
noteTargetLine
.
line
_c
ode
,
note
:
options
.
note
,
position
,
},
...
...
@@ -225,61 +231,61 @@ describe('DiffsStoreUtils', () => {
const
lines
=
[{
type
:
null
},
{
type
:
MATCH_LINE_TYPE
}];
const
linesWithReferences
=
utils
.
addLineReferences
(
lines
,
lineNumbers
,
true
);
expect
(
linesWithReferences
[
0
].
old
L
ine
).
toEqual
(
lineNumbers
.
oldLineNumber
+
1
);
expect
(
linesWithReferences
[
0
].
new
L
ine
).
toEqual
(
lineNumbers
.
newLineNumber
+
1
);
expect
(
linesWithReferences
[
1
].
meta
Data
.
oldP
os
).
toEqual
(
4
);
expect
(
linesWithReferences
[
1
].
meta
Data
.
newP
os
).
toEqual
(
5
);
expect
(
linesWithReferences
[
0
].
old
_l
ine
).
toEqual
(
lineNumbers
.
oldLineNumber
+
1
);
expect
(
linesWithReferences
[
0
].
new
_l
ine
).
toEqual
(
lineNumbers
.
newLineNumber
+
1
);
expect
(
linesWithReferences
[
1
].
meta
_data
.
old_p
os
).
toEqual
(
4
);
expect
(
linesWithReferences
[
1
].
meta
_data
.
new_p
os
).
toEqual
(
5
);
});
it
(
'
should add correct line references when bottom falsy
'
,
()
=>
{
const
lines
=
[{
type
:
null
},
{
type
:
MATCH_LINE_TYPE
},
{
type
:
null
}];
const
linesWithReferences
=
utils
.
addLineReferences
(
lines
,
lineNumbers
);
expect
(
linesWithReferences
[
0
].
old
L
ine
).
toEqual
(
0
);
expect
(
linesWithReferences
[
0
].
new
L
ine
).
toEqual
(
1
);
expect
(
linesWithReferences
[
1
].
meta
Data
.
oldP
os
).
toEqual
(
2
);
expect
(
linesWithReferences
[
1
].
meta
Data
.
newP
os
).
toEqual
(
3
);
expect
(
linesWithReferences
[
0
].
old
_l
ine
).
toEqual
(
0
);
expect
(
linesWithReferences
[
0
].
new
_l
ine
).
toEqual
(
1
);
expect
(
linesWithReferences
[
1
].
meta
_data
.
old_p
os
).
toEqual
(
2
);
expect
(
linesWithReferences
[
1
].
meta
_data
.
new_p
os
).
toEqual
(
3
);
});
});
describe
(
'
trimFirstCharOfLineContent
'
,
()
=>
{
it
(
'
trims the line when it starts with a space
'
,
()
=>
{
expect
(
utils
.
trimFirstCharOfLineContent
({
rich
T
ext
:
'
diff
'
})).
toEqual
({
expect
(
utils
.
trimFirstCharOfLineContent
({
rich
_t
ext
:
'
diff
'
})).
toEqual
({
discussions
:
[],
rich
T
ext
:
'
diff
'
,
rich
_t
ext
:
'
diff
'
,
});
});
it
(
'
trims the line when it starts with a +
'
,
()
=>
{
expect
(
utils
.
trimFirstCharOfLineContent
({
rich
T
ext
:
'
+diff
'
})).
toEqual
({
expect
(
utils
.
trimFirstCharOfLineContent
({
rich
_t
ext
:
'
+diff
'
})).
toEqual
({
discussions
:
[],
rich
T
ext
:
'
diff
'
,
rich
_t
ext
:
'
diff
'
,
});
});
it
(
'
trims the line when it starts with a -
'
,
()
=>
{
expect
(
utils
.
trimFirstCharOfLineContent
({
rich
T
ext
:
'
-diff
'
})).
toEqual
({
expect
(
utils
.
trimFirstCharOfLineContent
({
rich
_t
ext
:
'
-diff
'
})).
toEqual
({
discussions
:
[],
rich
T
ext
:
'
diff
'
,
rich
_t
ext
:
'
diff
'
,
});
});
it
(
'
does not trims the line when it starts with a letter
'
,
()
=>
{
expect
(
utils
.
trimFirstCharOfLineContent
({
rich
T
ext
:
'
diff
'
})).
toEqual
({
expect
(
utils
.
trimFirstCharOfLineContent
({
rich
_t
ext
:
'
diff
'
})).
toEqual
({
discussions
:
[],
rich
T
ext
:
'
diff
'
,
rich
_t
ext
:
'
diff
'
,
});
});
it
(
'
does not modify the provided object
'
,
()
=>
{
const
lineObj
=
{
discussions
:
[],
rich
T
ext
:
'
diff
'
,
rich
_t
ext
:
'
diff
'
,
};
utils
.
trimFirstCharOfLineContent
(
lineObj
);
expect
(
lineObj
).
toEqual
({
discussions
:
[],
rich
T
ext
:
'
diff
'
});
expect
(
lineObj
).
toEqual
({
discussions
:
[],
rich
_t
ext
:
'
diff
'
});
});
it
(
'
handles a undefined or null parameter
'
,
()
=>
{
...
...
@@ -289,33 +295,33 @@ describe('DiffsStoreUtils', () => {
describe
(
'
prepareDiffData
'
,
()
=>
{
it
(
'
sets the renderIt and collapsed attribute on files
'
,
()
=>
{
const
preparedDiff
=
{
diff
F
iles
:
[
getDiffFileMock
()]
};
const
preparedDiff
=
{
diff
_f
iles
:
[
getDiffFileMock
()]
};
utils
.
prepareDiffData
(
preparedDiff
);
const
firstParallelDiffLine
=
preparedDiff
.
diff
Files
[
0
].
parallelDiffL
ines
[
2
];
const
firstParallelDiffLine
=
preparedDiff
.
diff
_files
[
0
].
parallel_diff_l
ines
[
2
];
expect
(
firstParallelDiffLine
.
left
.
discussions
.
length
).
toBe
(
0
);
expect
(
firstParallelDiffLine
.
left
).
not
.
toHaveAttr
(
'
text
'
);
expect
(
firstParallelDiffLine
.
right
.
discussions
.
length
).
toBe
(
0
);
expect
(
firstParallelDiffLine
.
right
).
not
.
toHaveAttr
(
'
text
'
);
const
firstParallelChar
=
firstParallelDiffLine
.
right
.
rich
T
ext
.
charAt
(
0
);
const
firstParallelChar
=
firstParallelDiffLine
.
right
.
rich
_t
ext
.
charAt
(
0
);
expect
(
firstParallelChar
).
not
.
toBe
(
'
'
);
expect
(
firstParallelChar
).
not
.
toBe
(
'
+
'
);
expect
(
firstParallelChar
).
not
.
toBe
(
'
-
'
);
const
checkLine
=
preparedDiff
.
diff
Files
[
0
].
highlightedDiffL
ines
[
0
];
const
checkLine
=
preparedDiff
.
diff
_files
[
0
].
highlighted_diff_l
ines
[
0
];
expect
(
checkLine
.
discussions
.
length
).
toBe
(
0
);
expect
(
checkLine
).
not
.
toHaveAttr
(
'
text
'
);
const
firstChar
=
checkLine
.
rich
T
ext
.
charAt
(
0
);
const
firstChar
=
checkLine
.
rich
_t
ext
.
charAt
(
0
);
expect
(
firstChar
).
not
.
toBe
(
'
'
);
expect
(
firstChar
).
not
.
toBe
(
'
+
'
);
expect
(
firstChar
).
not
.
toBe
(
'
-
'
);
expect
(
preparedDiff
.
diff
F
iles
[
0
].
renderIt
).
toBeTruthy
();
expect
(
preparedDiff
.
diff
F
iles
[
0
].
collapsed
).
toBeFalsy
();
expect
(
preparedDiff
.
diff
_f
iles
[
0
].
renderIt
).
toBeTruthy
();
expect
(
preparedDiff
.
diff
_f
iles
[
0
].
collapsed
).
toBeFalsy
();
});
});
...
...
@@ -398,7 +404,7 @@ describe('DiffsStoreUtils', () => {
discussion
,
diffPosition
:
{
...
diffPosition
,
line
C
ode
:
'
ABC_1
'
,
line
_c
ode
:
'
ABC_1
'
,
},
latestDiff
:
true
,
}),
...
...
@@ -429,36 +435,36 @@ describe('DiffsStoreUtils', () => {
beforeAll
(()
=>
{
files
=
[
{
new
P
ath
:
'
app/index.js
'
,
deleted
F
ile
:
false
,
new
F
ile
:
false
,
removed
L
ines
:
10
,
added
L
ines
:
0
,
file
H
ash
:
'
test
'
,
new
_p
ath
:
'
app/index.js
'
,
deleted
_f
ile
:
false
,
new
_f
ile
:
false
,
removed
_l
ines
:
10
,
added
_l
ines
:
0
,
file
_h
ash
:
'
test
'
,
},
{
new
P
ath
:
'
app/test/index.js
'
,
deleted
F
ile
:
false
,
new
F
ile
:
true
,
removed
L
ines
:
0
,
added
L
ines
:
0
,
file
H
ash
:
'
test
'
,
new
_p
ath
:
'
app/test/index.js
'
,
deleted
_f
ile
:
false
,
new
_f
ile
:
true
,
removed
_l
ines
:
0
,
added
_l
ines
:
0
,
file
_h
ash
:
'
test
'
,
},
{
new
P
ath
:
'
app/test/filepathneedstruncating.js
'
,
deleted
F
ile
:
false
,
new
F
ile
:
true
,
removed
L
ines
:
0
,
added
L
ines
:
0
,
file
H
ash
:
'
test
'
,
new
_p
ath
:
'
app/test/filepathneedstruncating.js
'
,
deleted
_f
ile
:
false
,
new
_f
ile
:
true
,
removed
_l
ines
:
0
,
added
_l
ines
:
0
,
file
_h
ash
:
'
test
'
,
},
{
new
P
ath
:
'
package.json
'
,
deleted
F
ile
:
true
,
new
F
ile
:
false
,
removed
L
ines
:
0
,
added
L
ines
:
0
,
file
H
ash
:
'
test
'
,
new
_p
ath
:
'
package.json
'
,
deleted
_f
ile
:
true
,
new
_f
ile
:
false
,
removed
_l
ines
:
0
,
added
_l
ines
:
0
,
file
_h
ash
:
'
test
'
,
},
];
});
...
...
spec/javascripts/notes/components/diff_with_note_spec.js
View file @
290f8281
import
Vue
from
'
vue
'
;
import
DiffWithNote
from
'
~/notes/components/diff_with_note.vue
'
;
import
{
convertObjectPropsToCamelCase
}
from
'
~/lib/utils/common_utils
'
;
import
{
createStore
}
from
'
~/mr_notes/stores
'
;
import
{
mountComponentWithStore
}
from
'
spec/helpers
'
;
...
...
@@ -11,7 +10,7 @@ describe('diff_with_note', () => {
let
store
;
let
vm
;
const
diffDiscussionMock
=
getJSONFixture
(
discussionFixture
)[
0
];
const
diffDiscussion
=
convertObjectPropsToCamelCase
(
diffDiscussionMock
)
;
const
diffDiscussion
=
diffDiscussionMock
;
const
Component
=
Vue
.
extend
(
DiffWithNote
);
const
props
=
{
discussion
:
diffDiscussion
,
...
...
@@ -65,7 +64,7 @@ describe('diff_with_note', () => {
describe
(
'
image diff
'
,
()
=>
{
beforeEach
(()
=>
{
const
imageDiffDiscussionMock
=
getJSONFixture
(
imageDiscussionFixture
)[
0
];
props
.
discussion
=
convertObjectPropsToCamelCase
(
imageDiffDiscussionMock
)
;
props
.
discussion
=
imageDiffDiscussionMock
;
});
it
(
'
shows image diff
'
,
()
=>
{
...
...
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