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
b13ecdd6
Commit
b13ecdd6
authored
Apr 12, 2019
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CE backport of image-comment-reviews
parent
0276b868
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
39 additions
and
11 deletions
+39
-11
app/assets/javascripts/diffs/components/diff_content.vue
app/assets/javascripts/diffs/components/diff_content.vue
+15
-6
app/assets/javascripts/diffs/components/image_diff_overlay.vue
...ssets/javascripts/diffs/components/image_diff_overlay.vue
+5
-4
app/assets/javascripts/diffs/mixins/draft_comments.js
app/assets/javascripts/diffs/mixins/draft_comments.js
+3
-0
app/assets/javascripts/diffs/mixins/image_diff.js
app/assets/javascripts/diffs/mixins/image_diff.js
+13
-0
app/assets/javascripts/diffs/store/mutations.js
app/assets/javascripts/diffs/store/mutations.js
+3
-1
No files found.
app/assets/javascripts/diffs/components/diff_content.vue
View file @
b13ecdd6
<
script
>
<
script
>
import
{
mapActions
,
mapGetters
,
mapState
}
from
'
vuex
'
;
import
{
mapActions
,
mapGetters
,
mapState
}
from
'
vuex
'
;
import
diffLineNoteFormMixin
from
'
ee_else_ce/notes/mixins/diff_line_note_form
'
;
import
draftCommentsMixin
from
'
ee_else_ce/diffs/mixins/draft_comments
'
;
import
DiffViewer
from
'
~/vue_shared/components/diff_viewer/diff_viewer.vue
'
;
import
DiffViewer
from
'
~/vue_shared/components/diff_viewer/diff_viewer.vue
'
;
import
NotDiffableViewer
from
'
~/vue_shared/components/diff_viewer/viewers/not_diffable.vue
'
;
import
NotDiffableViewer
from
'
~/vue_shared/components/diff_viewer/viewers/not_diffable.vue
'
;
import
NoPreviewViewer
from
'
~/vue_shared/components/diff_viewer/viewers/no_preview.vue
'
;
import
NoPreviewViewer
from
'
~/vue_shared/components/diff_viewer/viewers/no_preview.vue
'
;
...
@@ -22,7 +24,9 @@ export default {
...
@@ -22,7 +24,9 @@ export default {
ImageDiffOverlay
,
ImageDiffOverlay
,
NotDiffableViewer
,
NotDiffableViewer
,
NoPreviewViewer
,
NoPreviewViewer
,
DiffFileDrafts
:
()
=>
import
(
'
ee_component/batch_comments/components/diff_file_drafts.vue
'
),
},
},
mixins
:
[
diffLineNoteFormMixin
,
draftCommentsMixin
],
props
:
{
props
:
{
diffFile
:
{
diffFile
:
{
type
:
Object
,
type
:
Object
,
...
@@ -58,10 +62,13 @@ export default {
...
@@ -58,10 +62,13 @@ export default {
return
this
.
diffViewerMode
===
diffViewerModes
.
not_diffable
;
return
this
.
diffViewerMode
===
diffViewerModes
.
not_diffable
;
},
},
diffFileCommentForm
()
{
diffFileCommentForm
()
{
return
this
.
getCommentFormForDiffFile
(
this
.
diffFile
.
file_h
ash
);
return
this
.
getCommentFormForDiffFile
(
this
.
diffFile
H
ash
);
},
},
showNotesContainer
()
{
showNotesContainer
()
{
return
this
.
diffFile
.
discussions
.
length
||
this
.
diffFileCommentForm
;
return
this
.
imageDiscussions
.
length
||
this
.
diffFileCommentForm
;
},
diffFileHash
()
{
return
this
.
diffFile
.
file_hash
;
},
},
},
},
methods
:
{
methods
:
{
...
@@ -112,15 +119,15 @@ export default {
...
@@ -112,15 +119,15 @@ export default {
:new-sha=
"diffFile.diff_refs.head_sha"
:new-sha=
"diffFile.diff_refs.head_sha"
:old-path=
"diffFile.old_path"
:old-path=
"diffFile.old_path"
:old-sha=
"diffFile.diff_refs.base_sha"
:old-sha=
"diffFile.diff_refs.base_sha"
:file-hash=
"diffFile
.file_h
ash"
:file-hash=
"diffFile
H
ash"
:project-path=
"projectPath"
:project-path=
"projectPath"
:a-mode=
"diffFile.a_mode"
:a-mode=
"diffFile.a_mode"
:b-mode=
"diffFile.b_mode"
:b-mode=
"diffFile.b_mode"
>
>
<image-diff-overlay
<image-diff-overlay
slot=
"image-overlay"
slot=
"image-overlay"
:discussions=
"
diffFile.d
iscussions"
:discussions=
"
imageD
iscussions"
:file-hash=
"diffFile
.file_h
ash"
:file-hash=
"diffFile
H
ash"
:can-comment=
"getNoteableData.current_user.can_create_note"
:can-comment=
"getNoteableData.current_user.can_create_note"
/>
/>
<div
v-if=
"showNotesContainer"
class=
"note-container"
>
<div
v-if=
"showNotesContainer"
class=
"note-container"
>
...
@@ -131,14 +138,16 @@ export default {
...
@@ -131,14 +138,16 @@ export default {
:should-collapse-discussions=
"true"
:should-collapse-discussions=
"true"
:render-avatar-badge=
"true"
:render-avatar-badge=
"true"
/>
/>
<diff-file-drafts
:file-hash=
"diffFileHash"
class=
"diff-file-discussions"
/>
<note-form
<note-form
v-if=
"diffFileCommentForm"
v-if=
"diffFileCommentForm"
ref=
"noteForm"
ref=
"noteForm"
:is-editing=
"false"
:is-editing=
"false"
:save-button-title=
"__('Comment')"
:save-button-title=
"__('Comment')"
class=
"diff-comment-form new-note discussion-form discussion-form-container"
class=
"diff-comment-form new-note discussion-form discussion-form-container"
@
handleFormUpdateAddToReview=
"addToReview"
@
handleFormUpdate=
"handleSaveNote"
@
handleFormUpdate=
"handleSaveNote"
@
cancelForm=
"closeDiffFileCommentForm(diffFile
.file_h
ash)"
@
cancelForm=
"closeDiffFileCommentForm(diffFile
H
ash)"
/>
/>
</div>
</div>
</diff-viewer>
</diff-viewer>
...
...
app/assets/javascripts/diffs/components/image_diff_overlay.vue
View file @
b13ecdd6
<
script
>
<
script
>
import
{
mapActions
,
mapGetters
}
from
'
vuex
'
;
import
{
mapActions
,
mapGetters
}
from
'
vuex
'
;
import
_
from
'
underscore
'
;
import
_
from
'
underscore
'
;
import
imageDiffMixin
from
'
ee_else_ce/diffs/mixins/image_diff
'
;
import
Icon
from
'
~/vue_shared/components/icon.vue
'
;
import
Icon
from
'
~/vue_shared/components/icon.vue
'
;
export
default
{
export
default
{
...
@@ -8,6 +9,7 @@ export default {
...
@@ -8,6 +9,7 @@ export default {
components
:
{
components
:
{
Icon
,
Icon
,
},
},
mixins
:
[
imageDiffMixin
],
props
:
{
props
:
{
discussions
:
{
discussions
:
{
type
:
[
Array
,
Object
],
type
:
[
Array
,
Object
],
...
@@ -48,7 +50,6 @@ export default {
...
@@ -48,7 +50,6 @@ export default {
},
},
},
},
methods
:
{
methods
:
{
...
mapActions
([
'
toggleDiscussion
'
]),
...
mapActions
(
'
diffs
'
,
[
'
openDiffFileCommentForm
'
]),
...
mapActions
(
'
diffs
'
,
[
'
openDiffFileCommentForm
'
]),
getImageDimensions
()
{
getImageDimensions
()
{
return
{
return
{
...
@@ -105,15 +106,15 @@ export default {
...
@@ -105,15 +106,15 @@ export default {
v-for=
"(discussion, index) in allDiscussions"
v-for=
"(discussion, index) in allDiscussions"
:key=
"discussion.id"
:key=
"discussion.id"
:style=
"getPosition(discussion)"
:style=
"getPosition(discussion)"
:class=
"
badgeClass
"
:class=
"
[badgeClass,
{ 'is-draft': discussion.isDraft }]
"
:disabled="!shouldToggleDiscussion"
:disabled="!shouldToggleDiscussion"
class="js-image-badge"
class="js-image-badge"
type="button"
type="button"
@
click=
"
toggleDiscussion(
{ discussionId: discussion.id }
)"
@click="
clickedToggle(discussion
)"
>
>
<icon
v-if=
"showCommentIcon"
name=
"image-comment-dark"
/>
<icon
v-if=
"showCommentIcon"
name=
"image-comment-dark"
/>
<template
v-else
>
<template
v-else
>
{{
index
+
1
}}
{{
toggleText
(
discussion
,
index
)
}}
</
template
>
</
template
>
</button>
</button>
<button
<button
...
...
app/assets/javascripts/diffs/mixins/draft_comments.js
View file @
b13ecdd6
...
@@ -3,5 +3,8 @@ export default {
...
@@ -3,5 +3,8 @@ export default {
shouldRenderDraftRow
:
()
=>
()
=>
false
,
shouldRenderDraftRow
:
()
=>
()
=>
false
,
shouldRenderParallelDraftRow
:
()
=>
()
=>
false
,
shouldRenderParallelDraftRow
:
()
=>
()
=>
false
,
draftForLine
:
()
=>
()
=>
({}),
draftForLine
:
()
=>
()
=>
({}),
imageDiscussions
()
{
return
this
.
diffFile
.
discussions
;
},
},
},
};
};
app/assets/javascripts/diffs/mixins/image_diff.js
0 → 100644
View file @
b13ecdd6
import
{
mapActions
}
from
'
vuex
'
;
export
default
{
methods
:
{
...
mapActions
([
'
toggleDiscussion
'
]),
clickedToggle
(
discussion
)
{
this
.
toggleDiscussion
({
discussionId
:
discussion
.
id
});
},
toggleText
(
discussion
,
index
)
{
return
index
+
1
;
},
},
};
app/assets/javascripts/diffs/store/mutations.js
View file @
b13ecdd6
...
@@ -160,7 +160,9 @@ export default {
...
@@ -160,7 +160,9 @@ export default {
}
}
if
(
!
file
.
parallel_diff_lines
||
!
file
.
highlighted_diff_lines
)
{
if
(
!
file
.
parallel_diff_lines
||
!
file
.
highlighted_diff_lines
)
{
file
.
discussions
=
(
file
.
discussions
||
[]).
concat
(
discussion
);
file
.
discussions
=
(
file
.
discussions
||
[])
.
filter
(
d
=>
d
.
id
!==
discussion
.
id
)
.
concat
(
discussion
);
}
}
return
file
;
return
file
;
...
...
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