Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
8441fc47
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,发现更多精彩内容 >>
提交
8441fc47
编写于
2月 18, 2019
作者:
W
Winnie Hellmann
提交者:
Phil Hughes
2月 18, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove noteId prop from ReplyButton component
Move convertToDiscussion call from ReplyButton to NoteApp component
上级
e52f97a9
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
37 addition
and
49 deletion
+37
-49
app/assets/javascripts/notes/components/note_actions.vue
app/assets/javascripts/notes/components/note_actions.vue
+1
-6
app/assets/javascripts/notes/components/note_actions/reply_button.vue
...avascripts/notes/components/note_actions/reply_button.vue
+1
-11
app/assets/javascripts/notes/components/noteable_discussion.vue
...sets/javascripts/notes/components/noteable_discussion.vue
+13
-0
app/assets/javascripts/notes/components/noteable_note.vue
app/assets/javascripts/notes/components/noteable_note.vue
+6
-13
app/assets/javascripts/notes/components/notes_app.vue
app/assets/javascripts/notes/components/notes_app.vue
+12
-1
spec/javascripts/notes/components/note_actions/reply_button_spec.js
...cripts/notes/components/note_actions/reply_button_spec.js
+4
-18
未找到文件。
app/assets/javascripts/notes/components/note_actions.vue
浏览文件 @
8441fc47
...
...
@@ -23,11 +23,6 @@ export default {
type
:
[
String
,
Number
],
required
:
true
,
},
discussionId
:
{
type
:
String
,
required
:
false
,
default
:
''
,
},
noteUrl
:
{
type
:
String
,
required
:
false
,
...
...
@@ -176,7 +171,7 @@ export default {
v-if=
"showReplyButton"
ref=
"replyButton"
class=
"js-reply-button"
:note-id=
"discussionId
"
@
startReplying=
"$emit('startReplying')
"
/>
<div
v-if=
"canEdit"
class=
"note-actions-item"
>
<button
...
...
app/assets/javascripts/notes/components/note_actions/reply_button.vue
浏览文件 @
8441fc47
<
script
>
import
{
mapActions
}
from
'
vuex
'
;
import
{
GlTooltipDirective
,
GlButton
}
from
'
@gitlab/ui
'
;
import
Icon
from
'
~/vue_shared/components/icon.vue
'
;
...
...
@@ -12,15 +11,6 @@ export default {
directives
:
{
GlTooltip
:
GlTooltipDirective
,
},
props
:
{
noteId
:
{
type
:
String
,
required
:
true
,
},
},
methods
:
{
...
mapActions
([
'
convertToDiscussion
'
]),
},
};
</
script
>
...
...
@@ -32,7 +22,7 @@ export default {
class=
"note-action-button"
variant=
"transparent"
:title=
"__('Reply to comment')"
@
click=
"
convertToDiscussion(noteId
)"
@
click=
"
$emit('startReplying'
)"
>
<icon
name=
"comment"
css-classes=
"link-highlight"
/>
</gl-button>
...
...
app/assets/javascripts/notes/components/noteable_discussion.vue
浏览文件 @
8441fc47
...
...
@@ -26,6 +26,7 @@ import resolvable from '../mixins/resolvable';
import
discussionNavigation
from
'
../mixins/discussion_navigation
'
;
import
ReplyPlaceholder
from
'
./discussion_reply_placeholder.vue
'
;
import
jumpToNextDiscussionButton
from
'
./discussion_jump_to_next_button.vue
'
;
import
eventHub
from
'
../event_hub
'
;
export
default
{
name
:
'
NoteableDiscussion
'
,
...
...
@@ -246,6 +247,12 @@ export default {
}
},
},
created
()
{
eventHub
.
$on
(
'
startReplying
'
,
this
.
onStartReplying
);
},
beforeDestroy
()
{
eventHub
.
$off
(
'
startReplying
'
,
this
.
onStartReplying
);
},
methods
:
{
...
mapActions
([
'
saveNote
'
,
...
...
@@ -350,6 +357,11 @@ Please check your network connection and try again.`;
deleteNoteHandler
(
note
)
{
this
.
$emit
(
'
noteDeleted
'
,
this
.
discussion
,
note
);
},
onStartReplying
(
discussionId
)
{
if
(
this
.
discussion
.
id
===
discussionId
)
{
this
.
showReplyForm
();
}
},
},
};
</
script
>
...
...
@@ -412,6 +424,7 @@ Please check your network connection and try again.`;
:help-page-path=
"helpPagePath"
:show-reply-button=
"canReply"
@
handleDeleteNote=
"deleteNoteHandler"
@
startReplying=
"showReplyForm"
>
<note-edited-text
v-if=
"discussion.resolved"
...
...
app/assets/javascripts/notes/components/noteable_note.vue
浏览文件 @
8441fc47
...
...
@@ -29,11 +29,6 @@ export default {
type
:
Object
,
required
:
true
,
},
discussion
:
{
type
:
Object
,
required
:
false
,
default
:
null
,
},
line
:
{
type
:
Object
,
required
:
false
,
...
...
@@ -49,6 +44,11 @@ export default {
required
:
false
,
default
:
()
=>
null
,
},
showReplyButton
:
{
type
:
Boolean
,
required
:
false
,
default
:
false
,
},
},
data
()
{
return
{
...
...
@@ -91,13 +91,6 @@ export default {
}
return
''
;
},
showReplyButton
()
{
if
(
!
this
.
discussion
||
!
this
.
getNoteableData
.
current_user
.
can_create_note
)
{
return
false
;
}
return
this
.
discussion
.
individual_note
&&
!
this
.
commentsDisabled
;
},
actionText
()
{
if
(
!
this
.
commit
)
{
return
''
;
...
...
@@ -260,10 +253,10 @@ export default {
:is-resolved=
"note.resolved"
:is-resolving=
"isResolving"
:resolved-by=
"note.resolved_by"
:discussion-id=
"discussionId"
@
handleEdit=
"editHandler"
@
handleDelete=
"deleteHandler"
@
handleResolve=
"resolveHandler"
@
startReplying=
"$emit('startReplying')"
/>
</div>
<div
class=
"timeline-discussion-body"
>
...
...
app/assets/javascripts/notes/components/notes_app.vue
浏览文件 @
8441fc47
...
...
@@ -64,6 +64,7 @@ export default {
'
getNotesDataByProp
'
,
'
isLoading
'
,
'
commentsDisabled
'
,
'
getNoteableData
'
,
]),
noteableType
()
{
return
this
.
noteableData
.
noteableType
;
...
...
@@ -79,6 +80,9 @@ export default {
return
this
.
discussions
;
},
canReply
()
{
return
this
.
getNoteableData
.
current_user
.
can_create_note
&&
!
this
.
commentsDisabled
;
},
},
watch
:
{
shouldShow
()
{
...
...
@@ -129,6 +133,7 @@ export default {
'
setNotesFetchedState
'
,
'
expandDiscussion
'
,
'
startTaskList
'
,
'
convertToDiscussion
'
,
]),
fetchNotes
()
{
if
(
this
.
isFetching
)
return
null
;
...
...
@@ -176,6 +181,11 @@ export default {
}
}
},
startReplying
(
discussionId
)
{
return
this
.
convertToDiscussion
(
discussionId
)
.
then
(()
=>
this
.
$nextTick
())
.
then
(()
=>
eventHub
.
$emit
(
'
startReplying
'
,
discussionId
));
},
},
systemNote
:
constants
.
SYSTEM_NOTE
,
};
...
...
@@ -206,7 +216,8 @@ export default {
v-else
:key=
"discussion.id"
:note=
"discussion.notes[0]"
:discussion=
"discussion"
:show-reply-button=
"canReply"
@
startReplying=
"startReplying(discussion.id)"
/>
</
template
>
<noteable-discussion
...
...
spec/javascripts/notes/components/note_actions/reply_button_spec.js
浏览文件 @
8441fc47
...
...
@@ -3,27 +3,14 @@ import { createLocalVue, mount } from '@vue/test-utils';
import
ReplyButton
from
'
~/notes/components/note_actions/reply_button.vue
'
;
describe
(
'
ReplyButton
'
,
()
=>
{
const
noteId
=
'
dummy-note-id
'
;
let
wrapper
;
let
convertToDiscussion
;
beforeEach
(()
=>
{
const
localVue
=
createLocalVue
();
convertToDiscussion
=
jasmine
.
createSpy
(
'
convertToDiscussion
'
);
localVue
.
use
(
Vuex
);
const
store
=
new
Vuex
.
Store
({
actions
:
{
convertToDiscussion
,
},
});
wrapper
=
mount
(
ReplyButton
,
{
propsData
:
{
noteId
,
},
store
,
sync
:
false
,
localVue
,
});
...
...
@@ -33,14 +20,13 @@ describe('ReplyButton', () => {
wrapper
.
destroy
();
});
it
(
'
dispatches convertToDiscussion with note ID
on click
'
,
()
=>
{
it
(
'
emits startReplying
on click
'
,
()
=>
{
const
button
=
wrapper
.
find
({
ref
:
'
button
'
});
button
.
trigger
(
'
click
'
);
expect
(
convertToDiscussion
).
toHaveBeenCalledTimes
(
1
);
const
[,
payload
]
=
convertToDiscussion
.
calls
.
argsFor
(
0
);
expect
(
payload
).
toBe
(
noteId
);
expect
(
wrapper
.
emitted
()).
toEqual
({
startReplying
:
[[]],
});
});
});
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录