Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
e6cf3c7a
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
e6cf3c7a
编写于
11月 21, 2018
作者:
F
Fatih Acet
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Allow commenting to resolved non-diff discussions
上级
8e11f1fa
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
56 addition
and
3 deletion
+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
未找到文件。
app/assets/javascripts/notes/components/noteable_discussion.vue
浏览文件 @
e6cf3c7a
...
...
@@ -68,7 +68,7 @@ export default {
isReplying
:
false
,
isResolving
:
false
,
resolveAsThread
:
true
,
isReplies
Collapsed
:
(
!
this
.
discussion
.
diff_discussion
&&
this
.
discussion
.
resolved
)
||
false
,
isReplies
ToggledByUser
:
false
,
};
},
computed
:
{
...
...
@@ -189,6 +189,15 @@ export default {
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
:
{
isReplying
()
{
...
...
@@ -233,7 +242,7 @@ export default {
this
.
toggleDiscussion
({
discussionId
:
this
.
discussion
.
id
});
},
toggleReplies
()
{
this
.
isReplies
Collapsed
=
!
this
.
isRepliesCollapsed
;
this
.
isReplies
ToggledByUser
=
!
this
.
isRepliesToggledByUser
;
},
showReplyForm
()
{
this
.
isReplying
=
true
;
...
...
app/assets/javascripts/notes/components/toggle_replies_widget.vue
浏览文件 @
e6cf3c7a
...
...
@@ -42,7 +42,7 @@ export default {
</
script
>
<
template
>
<li
:class=
"className"
class=
"replies-toggle"
>
<li
:class=
"className"
class=
"replies-toggle
js-toggle-replies
"
>
<template
v-if=
"collapsed"
>
<icon
name=
"chevron-right"
@
click.native=
"toggle"
/>
<div>
...
...
spec/javascripts/notes/components/noteable_discussion_spec.js
浏览文件 @
e6cf3c7a
...
...
@@ -6,6 +6,7 @@ import { noteableDataMock, discussionMock, notesDataMock } from '../mock_data';
import
mockDiffFile
from
'
../../diffs/mock_data/diff_file
'
;
const
discussionWithTwoUnresolvedNotes
=
'
merge_requests/resolved_diff_discussion.json
'
;
const
diffDiscussionFixture
=
'
merge_requests/diff_discussion.json
'
;
describe
(
'
noteable_discussion component
'
,
()
=>
{
const
Component
=
Vue
.
extend
(
noteableDiscussion
);
...
...
@@ -115,6 +116,49 @@ describe('noteable_discussion component', () => {
.
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
'
,
()
=>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录