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
>
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
NotDiffableViewer
from
'
~/vue_shared/components/diff_viewer/viewers/not_diffable.vue
'
;
import
NoPreviewViewer
from
'
~/vue_shared/components/diff_viewer/viewers/no_preview.vue
'
;
...
...
@@ -22,7 +24,9 @@ export default {
ImageDiffOverlay
,
NotDiffableViewer
,
NoPreviewViewer
,
DiffFileDrafts
:
()
=>
import
(
'
ee_component/batch_comments/components/diff_file_drafts.vue
'
),
},
mixins
:
[
diffLineNoteFormMixin
,
draftCommentsMixin
],
props
:
{
diffFile
:
{
type
:
Object
,
...
...
@@ -58,10 +62,13 @@ export default {
return
this
.
diffViewerMode
===
diffViewerModes
.
not_diffable
;
},
diffFileCommentForm
()
{
return
this
.
getCommentFormForDiffFile
(
this
.
diffFile
.
file_h
ash
);
return
this
.
getCommentFormForDiffFile
(
this
.
diffFile
H
ash
);
},
showNotesContainer
()
{
return
this
.
diffFile
.
discussions
.
length
||
this
.
diffFileCommentForm
;
return
this
.
imageDiscussions
.
length
||
this
.
diffFileCommentForm
;
},
diffFileHash
()
{
return
this
.
diffFile
.
file_hash
;
},
},
methods
:
{
...
...
@@ -112,15 +119,15 @@ export default {
:new-sha=
"diffFile.diff_refs.head_sha"
:old-path=
"diffFile.old_path"
:old-sha=
"diffFile.diff_refs.base_sha"
:file-hash=
"diffFile
.file_h
ash"
:file-hash=
"diffFile
H
ash"
:project-path=
"projectPath"
:a-mode=
"diffFile.a_mode"
:b-mode=
"diffFile.b_mode"
>
<image-diff-overlay
slot=
"image-overlay"
:discussions=
"
diffFile.d
iscussions"
:file-hash=
"diffFile
.file_h
ash"
:discussions=
"
imageD
iscussions"
:file-hash=
"diffFile
H
ash"
:can-comment=
"getNoteableData.current_user.can_create_note"
/>
<div
v-if=
"showNotesContainer"
class=
"note-container"
>
...
...
@@ -131,14 +138,16 @@ export default {
:should-collapse-discussions=
"true"
:render-avatar-badge=
"true"
/>
<diff-file-drafts
:file-hash=
"diffFileHash"
class=
"diff-file-discussions"
/>
<note-form
v-if=
"diffFileCommentForm"
ref=
"noteForm"
:is-editing=
"false"
:save-button-title=
"__('Comment')"
class=
"diff-comment-form new-note discussion-form discussion-form-container"
@
handleFormUpdateAddToReview=
"addToReview"
@
handleFormUpdate=
"handleSaveNote"
@
cancelForm=
"closeDiffFileCommentForm(diffFile
.file_h
ash)"
@
cancelForm=
"closeDiffFileCommentForm(diffFile
H
ash)"
/>
</div>
</diff-viewer>
...
...
app/assets/javascripts/diffs/components/image_diff_overlay.vue
View file @
b13ecdd6
<
script
>
import
{
mapActions
,
mapGetters
}
from
'
vuex
'
;
import
_
from
'
underscore
'
;
import
imageDiffMixin
from
'
ee_else_ce/diffs/mixins/image_diff
'
;
import
Icon
from
'
~/vue_shared/components/icon.vue
'
;
export
default
{
...
...
@@ -8,6 +9,7 @@ export default {
components
:
{
Icon
,
},
mixins
:
[
imageDiffMixin
],
props
:
{
discussions
:
{
type
:
[
Array
,
Object
],
...
...
@@ -48,7 +50,6 @@ export default {
},
},
methods
:
{
...
mapActions
([
'
toggleDiscussion
'
]),
...
mapActions
(
'
diffs
'
,
[
'
openDiffFileCommentForm
'
]),
getImageDimensions
()
{
return
{
...
...
@@ -105,15 +106,15 @@ export default {
v-for=
"(discussion, index) in allDiscussions"
:key=
"discussion.id"
:style=
"getPosition(discussion)"
:class=
"
badgeClass
"
:class=
"
[badgeClass,
{ 'is-draft': discussion.isDraft }]
"
:disabled="!shouldToggleDiscussion"
class="js-image-badge"
type="button"
@
click=
"
toggleDiscussion(
{ discussionId: discussion.id }
)"
@click="
clickedToggle(discussion
)"
>
<icon
v-if=
"showCommentIcon"
name=
"image-comment-dark"
/>
<template
v-else
>
{{
index
+
1
}}
{{
toggleText
(
discussion
,
index
)
}}
</
template
>
</button>
<button
...
...
app/assets/javascripts/diffs/mixins/draft_comments.js
View file @
b13ecdd6
...
...
@@ -3,5 +3,8 @@ export default {
shouldRenderDraftRow
:
()
=>
()
=>
false
,
shouldRenderParallelDraftRow
:
()
=>
()
=>
false
,
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 {
}
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
;
...
...
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