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
e6cf3c7a
Commit
e6cf3c7a
authored
Nov 21, 2018
by
Fatih Acet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow commenting to resolved non-diff discussions
parent
8e11f1fa
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
3 deletions
+56
-3
app/assets/javascripts/notes/components/noteable_discussion.vue
...sets/javascripts/notes/components/noteable_discussion.vue
+11
-2
app/assets/javascripts/notes/components/toggle_replies_widget.vue
...ts/javascripts/notes/components/toggle_replies_widget.vue
+1
-1
spec/javascripts/notes/components/noteable_discussion_spec.js
.../javascripts/notes/components/noteable_discussion_spec.js
+44
-0
No files found.
app/assets/javascripts/notes/components/noteable_discussion.vue
View file @
e6cf3c7a
...
@@ -68,7 +68,7 @@ export default {
...
@@ -68,7 +68,7 @@ export default {
isReplying
:
false
,
isReplying
:
false
,
isResolving
:
false
,
isResolving
:
false
,
resolveAsThread
:
true
,
resolveAsThread
:
true
,
isReplies
Collapsed
:
(
!
this
.
discussion
.
diff_discussion
&&
this
.
discussion
.
resolved
)
||
false
,
isReplies
ToggledByUser
:
false
,
};
};
},
},
computed
:
{
computed
:
{
...
@@ -189,6 +189,15 @@ export default {
...
@@ -189,6 +189,15 @@ export default {
return
isExpanded
||
this
.
alwaysExpanded
||
isResolvedNonDiffDiscussion
;
return
isExpanded
||
this
.
alwaysExpanded
||
isResolvedNonDiffDiscussion
;
},
},
isRepliesCollapsed
()
{
const
{
discussion
,
isRepliesToggledByUser
}
=
this
;
const
{
resolved
,
notes
}
=
discussion
;
const
hasReplies
=
notes
.
length
>
1
;
return
(
(
!
discussion
.
diff_discussion
&&
resolved
&&
hasReplies
&&
!
isRepliesToggledByUser
)
||
false
);
},
},
},
watch
:
{
watch
:
{
isReplying
()
{
isReplying
()
{
...
@@ -233,7 +242,7 @@ export default {
...
@@ -233,7 +242,7 @@ export default {
this
.
toggleDiscussion
({
discussionId
:
this
.
discussion
.
id
});
this
.
toggleDiscussion
({
discussionId
:
this
.
discussion
.
id
});
},
},
toggleReplies
()
{
toggleReplies
()
{
this
.
isReplies
Collapsed
=
!
this
.
isRepliesCollapsed
;
this
.
isReplies
ToggledByUser
=
!
this
.
isRepliesToggledByUser
;
},
},
showReplyForm
()
{
showReplyForm
()
{
this
.
isReplying
=
true
;
this
.
isReplying
=
true
;
...
...
app/assets/javascripts/notes/components/toggle_replies_widget.vue
View file @
e6cf3c7a
...
@@ -42,7 +42,7 @@ export default {
...
@@ -42,7 +42,7 @@ export default {
</
script
>
</
script
>
<
template
>
<
template
>
<li
:class=
"className"
class=
"replies-toggle"
>
<li
:class=
"className"
class=
"replies-toggle
js-toggle-replies
"
>
<template
v-if=
"collapsed"
>
<template
v-if=
"collapsed"
>
<icon
name=
"chevron-right"
@
click.native=
"toggle"
/>
<icon
name=
"chevron-right"
@
click.native=
"toggle"
/>
<div>
<div>
...
...
spec/javascripts/notes/components/noteable_discussion_spec.js
View file @
e6cf3c7a
...
@@ -6,6 +6,7 @@ import { noteableDataMock, discussionMock, notesDataMock } from '../mock_data';
...
@@ -6,6 +6,7 @@ import { noteableDataMock, discussionMock, notesDataMock } from '../mock_data';
import
mockDiffFile
from
'
../../diffs/mock_data/diff_file
'
;
import
mockDiffFile
from
'
../../diffs/mock_data/diff_file
'
;
const
discussionWithTwoUnresolvedNotes
=
'
merge_requests/resolved_diff_discussion.json
'
;
const
discussionWithTwoUnresolvedNotes
=
'
merge_requests/resolved_diff_discussion.json
'
;
const
diffDiscussionFixture
=
'
merge_requests/diff_discussion.json
'
;
describe
(
'
noteable_discussion component
'
,
()
=>
{
describe
(
'
noteable_discussion component
'
,
()
=>
{
const
Component
=
Vue
.
extend
(
noteableDiscussion
);
const
Component
=
Vue
.
extend
(
noteableDiscussion
);
...
@@ -115,6 +116,49 @@ describe('noteable_discussion component', () => {
...
@@ -115,6 +116,49 @@ describe('noteable_discussion component', () => {
.
catch
(
done
.
fail
);
.
catch
(
done
.
fail
);
});
});
});
});
describe
(
'
isRepliesCollapsed
'
,
()
=>
{
it
(
'
should return false for diff discussions
'
,
done
=>
{
const
diffDiscussion
=
getJSONFixture
(
diffDiscussionFixture
)[
0
];
vm
.
$store
.
dispatch
(
'
setInitialNotes
'
,
[
diffDiscussion
]);
Vue
.
nextTick
()
.
then
(()
=>
{
expect
(
vm
.
isRepliesCollapsed
).
toEqual
(
false
);
expect
(
vm
.
$el
.
querySelector
(
'
.js-toggle-replies
'
)).
not
.
toBeNull
();
expect
(
vm
.
$el
.
querySelector
(
'
.discussion-reply-holder
'
)).
not
.
toBeNull
();
})
.
then
(
done
)
.
catch
(
done
.
fail
);
});
it
(
'
should return false if discussion does not have a reply
'
,
()
=>
{
const
discussion
=
{
...
discussionMock
,
resolved
:
true
};
discussion
.
notes
=
discussion
.
notes
.
slice
(
0
,
1
);
const
noRepliesVm
=
new
Component
({
store
,
propsData
:
{
discussion
},
}).
$mount
();
expect
(
noRepliesVm
.
isRepliesCollapsed
).
toEqual
(
false
);
expect
(
noRepliesVm
.
$el
.
querySelector
(
'
.js-toggle-replies
'
)).
toBeNull
();
expect
(
vm
.
$el
.
querySelector
(
'
.discussion-reply-holder
'
)).
not
.
toBeNull
();
noRepliesVm
.
$destroy
();
});
it
(
'
should return true for resolved non-diff discussion which has replies
'
,
()
=>
{
const
discussion
=
{
...
discussionMock
,
resolved
:
true
};
const
resolvedDiscussionVm
=
new
Component
({
store
,
propsData
:
{
discussion
},
}).
$mount
();
expect
(
resolvedDiscussionVm
.
isRepliesCollapsed
).
toEqual
(
true
);
expect
(
resolvedDiscussionVm
.
$el
.
querySelector
(
'
.js-toggle-replies
'
)).
not
.
toBeNull
();
expect
(
vm
.
$el
.
querySelector
(
'
.discussion-reply-holder
'
)).
not
.
toBeNull
();
resolvedDiscussionVm
.
$destroy
();
});
});
});
});
describe
(
'
methods
'
,
()
=>
{
describe
(
'
methods
'
,
()
=>
{
...
...
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