Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
173ecfc4
Commit
173ecfc4
authored
Sep 03, 2018
by
Tim Zallmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delete Discussions fix
parent
958cf02e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
4 deletions
+48
-4
app/assets/javascripts/diffs/components/diff_discussions.vue
app/assets/javascripts/diffs/components/diff_discussions.vue
+10
-0
app/assets/javascripts/diffs/store/actions.js
app/assets/javascripts/diffs/store/actions.js
+24
-0
app/assets/javascripts/notes/components/noteable_discussion.vue
...sets/javascripts/notes/components/noteable_discussion.vue
+13
-4
app/assets/javascripts/notes/components/noteable_note.vue
app/assets/javascripts/notes/components/noteable_note.vue
+1
-0
No files found.
app/assets/javascripts/diffs/components/diff_discussions.vue
View file @
173ecfc4
<
script
>
import
{
mapActions
}
from
'
vuex
'
;
import
noteableDiscussion
from
'
../../notes/components/noteable_discussion.vue
'
;
export
default
{
...
...
@@ -11,6 +12,14 @@ export default {
required
:
true
,
},
},
methods
:
{
...
mapActions
(
'
diffs
'
,
[
'
removeDiscussionsFromDiff
'
]),
deleteNoteHandler
(
discussion
)
{
if
(
discussion
.
notes
.
length
<=
1
)
{
this
.
removeDiscussionsFromDiff
(
discussion
);
}
},
},
};
</
script
>
...
...
@@ -31,6 +40,7 @@ export default {
:render-diff-file=
"false"
:always-expanded=
"true"
:discussions-by-diff-order=
"true"
@
handleNoteDelete=
"deleteNoteHandler"
/>
</ul>
</div>
...
...
app/assets/javascripts/diffs/store/actions.js
View file @
173ecfc4
...
...
@@ -57,6 +57,30 @@ export const assignDiscussionsToDiff = ({ state }, allLineDiscussions) => {
});
};
export
const
removeDiscussionsFromDiff
=
({
state
},
removeDiscussion
)
=>
{
const
{
fileHash
}
=
removeDiscussion
;
const
selectedFile
=
state
.
diffFiles
.
find
(
file
=>
file
.
fileHash
===
fileHash
);
if
(
selectedFile
)
{
const
targetLine
=
selectedFile
.
parallelDiffLines
.
find
(
line
=>
(
line
.
left
&&
line
.
left
.
lineCode
===
removeDiscussion
.
line_code
)
||
(
line
.
right
&&
line
.
right
.
lineCode
===
removeDiscussion
.
line_code
),
);
if
(
targetLine
)
{
Object
.
assign
(
targetLine
.
right
,
{
discussions
:
[]
});
}
const
targetInlineLine
=
selectedFile
.
highlightedDiffLines
.
find
(
line
=>
line
.
lineCode
===
removeDiscussion
.
line_code
,
);
if
(
targetInlineLine
)
{
Object
.
assign
(
targetInlineLine
,
{
discussions
:
[]
});
}
}
};
export
const
startRenderDiffsQueue
=
({
state
,
commit
})
=>
{
const
checkItem
=
()
=>
new
Promise
(
resolve
=>
{
...
...
app/assets/javascripts/notes/components/noteable_discussion.vue
View file @
173ecfc4
...
...
@@ -137,8 +137,10 @@ export default {
return
this
.
unresolvedDiscussions
.
length
>
1
;
},
showJumpToNextDiscussion
()
{
return
this
.
hasMultipleUnresolvedDiscussions
&&
!
this
.
isLastUnresolvedDiscussion
(
this
.
discussion
.
id
,
this
.
discussionsByDiffOrder
);
return
(
this
.
hasMultipleUnresolvedDiscussions
&&
!
this
.
isLastUnresolvedDiscussion
(
this
.
discussion
.
id
,
this
.
discussionsByDiffOrder
)
);
},
shouldRenderDiffs
()
{
const
{
diffDiscussion
,
diffFile
}
=
this
.
transformedDiscussion
;
...
...
@@ -256,11 +258,16 @@ Please check your network connection and try again.`;
});
},
jumpToNextDiscussion
()
{
const
nextId
=
this
.
nextUnresolvedDiscussionId
(
this
.
discussion
.
id
,
this
.
discussionsByDiffOrder
);
const
nextId
=
this
.
nextUnresolvedDiscussionId
(
this
.
discussion
.
id
,
this
.
discussionsByDiffOrder
,
);
this
.
jumpToDiscussion
(
nextId
);
},
deleteNoteHandler
(
note
)
{
this
.
$emit
(
'
handleNoteDelete
'
,
this
.
discussion
,
note
);
},
},
};
</
script
>
...
...
@@ -270,6 +277,7 @@ Please check your network connection and try again.`;
<div
class=
"timeline-entry-inner"
>
<div
class=
"timeline-icon"
>
<user-avatar-link
v-if=
"author"
:link-href=
"author.path"
:img-src=
"author.avatar_url"
:img-alt=
"author.name"
...
...
@@ -344,6 +352,7 @@ Please check your network connection and try again.`;
:is=
"componentName(note)"
:note=
"componentData(note)"
:key=
"note.id"
@
handleDeleteNote=
"deleteNoteHandler"
/>
</ul>
<div
...
...
app/assets/javascripts/notes/components/noteable_note.vue
View file @
173ecfc4
...
...
@@ -86,6 +86,7 @@ export default {
// eslint-disable-next-line no-alert
if
(
window
.
confirm
(
'
Are you sure you want to delete this comment?
'
))
{
this
.
isDeleting
=
true
;
this
.
$emit
(
'
handleDeleteNote
'
,
this
.
note
);
this
.
deleteNote
(
this
.
note
)
.
then
(()
=>
{
...
...
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